在 JSP 中,test.jsp 文件如下,试图运行时,将发生()。 <html> <%String str = null;%> str is <%= str%> </html>A.执行编译后的 Servlet 时发生错误B.运行后,浏览器上显示:str isnullC.转译期有误D.编译 Servlet 源码时发生错误

在 JSP 中,test.jsp 文件如下,试图运行时,将发生()。 <html> <%String str = null;%> str is <%= str%> </html>

A.执行编译后的 Servlet 时发生错误

B.运行后,浏览器上显示:str isnull

C.转译期有误

D.编译 Servlet 源码时发生错误


参考答案和解析
运行后,浏览器上显示:stris null

相关考题:

下列哪个语句是声明一个含有10个String对象的数组( )?A.char str[];B.char str[][];C.String str[]=new String[10];D.String str[10];

已知String str=new String ("Luck");,则下列关于str的操作中不合法的是( )。A.String s=str. toUpperCase()B.int i=Str. length;C.char s=str. charAt(2);D.String s="Good" +str;

publicstaticvoidmain(String[]args){Stringstr=null?;if(str==null){System.out.println(”null”);}else(str.length()==0){System.out.println(”zero”);}else{System.out.println(”some”);}}Whatistheresult?() A.nullB.zeroC.someD.Compilationfails.E.Anexceptionisthrownatruntime.

下面代码的运行结果是( )。 public class ConcatTest { public static void main (String[ ] args) { String str1 = "abc"; String str2 = "ABC"; String str3 = str1. coneat(str2); System. out. println(str3); } }A.abcB.ABCC.abcABCD.ABCabc

下列( )语句是声明一个含有10个String对象的数组。A.char str [];B.char str [] [];C.String str[]=new String[10];D.String str[10];

下面是一个Applet程序,其功能是捕捉用户所按下的键,并将捕捉到的键时间,传给程序,程序再将所按下的字符显示在Applet中。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。注意:不改动程序的结构,不得增行或删行。程序运行结果如下:import java.awt.*;import java.applet.*;/*<applet code="ex15_3.class,, width=800 height=400 ></applet>*/public class ex15_3 extends JApplet{private String str1;private String str2;private String str3;public void init(){str1 = "Character:";str2 = "Number: ";str3 = "Key State:";}public void paint(Graphics g){g.drawString(str1, 20, 30);g.drawString(str2, 20, 50);g.drawString(str3, 20, 70);}public boolean keyUp(Event e, int n){str1 = "Character:" + String.valueOf(n);str2 = "Number:" + n;str3 = "Key State:Key Up";repaint();return true;}public boolean keyDown(Event e, int n){str1 = "Character:" + String.valueOf(n);str2 = "Number:" + n;str3 = "Key State:Key Down";repaint();return true;}}ex15_3.html<HTML><HEAD><TITLE>ex15_3</TITLE></HEAD><BODY><applet code="ex15 3.class" width=800 height=400 ></applet></BODY></HTML>

void Test(void){char *str = (char *)malloc(100); strcpy(str, “hello”); free(str); if(str != NULL) { strcpy(str, “world”); printf(str);}}请问运行 Test 函数会有什么样的结果?

C#中,string str = null 与 string str =””,请尽量用文字说明区别。(要点:说明详细的内存空间分配)

执行下面的程序,单击窗体后在窗体上显示的结果是 ______。Private Sub form_ Click() Dim Str1 As String, Str2 As String Dim Str3 As String, I As Integer Str1 = "e" for I = t To 2 Str2 = Ucase (Str1) Str1 = Str2 Str1 Str3 = Str3 Str1 str1 = Chr (Asc(Str1) + I) Next I Print Str3End SubA.EeFFB.eEfFC.EEFFD.eeFF

阅读以下说明,Java代码将应填入(n)处的字句写在对应栏内。【说明】链表和栈对象的共同特征是:在数据上执行的操作与在每个对象中实体存储的基本类型无关。例如,一个栈存储实体后,只要保证最后存储的项最先用,最先存储的项最后用,则栈的操作可以从链表的操作中派生得到。程序6-1实现了链表的操作,程序6-2实现了栈操作。import java.io.*;class Node //定义结点{ private String m_content;private Node m_next;Node(String str){ m_content=str;m_next=null; }Node(String str,Node next){ m_content=str;m_next=next; }String getData() //获取结点数据域{ return m_content;}void setNext(Node next] //设置下一个结点值{ m_next=next; }Node getNext() //返回下一个结点{ return m_next; )}【程序6-1】class List{ Node Head;List(){ Head=null; }void insert(String str) //将数据str的结点插入在整个链表前面{ if(Head==null)Head=new Node(str);else(1)}void append(String str) //将数据str的结点插入在整个链表尾部{ Node tempnode=Head;it(tempnode==null)Heed=new Node(str);else{ white(tempnode.getNext()!=null)(2)(3) }}String get() //移出链表第一个结点,并返回该结点的数据域{ Srting temp=new String();if(Head==null){ System.out.println("Errow! from empty list!")System.exit(0); }else{ temp=Head.getData();(4) }return temp;}}【程序6-2】class Stack extends List{ void push(String str) //进栈{ (5) }String pop() //出栈{ return get();}}

下面的程序各自独立,请问执行下面的四个TestMemory 函数各有什么样的结果?①void GetMemory(char * p){p = (char * )malloc(100);}void TestMemory (void){char *str = NULL;GetMemory (str);strcpy(str, "hello world");prinff(str);}② char * GetMemory (void){char p[ ] = "hello world";return p;}void TestMemory (void){char * str = NULL;str = GetMemory( );printf(str);}③void GetMemory(char * * p, int num){* p = (char * )malloc(num);}void TestMemory (void){char * str = NULL;GetMemory(str, 100);strcpy( str, "hello" );printf(sir);}④void TestMemory (void){char *str = (char * )malloe(100);strepy (str, "hello" );free ( str );if(str ! = NULL){strepy( str, "world" );printf(str);}}

在C#中,string str = null 与 string str = “” 请尽量使用文字或图象说明其中的区别。

public static void main(String[] args) {  String str = “null‟;  if (str == null) {  System.out.println(”null”);  } else (str.length() == 0) {  System.out.println(”zero”);  } else {  System.out.println(”some”);  }  }  What is the result?()A、 nullB、 zeroC、 someD、 Compilation fails.E、 An exception is thrown at runtime.

public class Test {  public static void main(String[] args) {  String str = NULL;  System.out.println(str);  }  }   What is the result?()  A、 NULLB、 Compilation fails.C、 The code runs with no output.D、 An exception is thrown at runtime.

下列哪个语句是声明了一个含有10个string对象的数组()。A、char str[];B、char str[][];C、string str[]=newstring[10];D、string str[10];

假如有字符串str1和字符串str2,下列选项不能利用于比较这两个字符串是否相等的是()。A、string.Compare(str1,str2)B、str1= =str2C、string.Equals(str1,str2)D、string.CompareTo(str1,str2)

C#中,新建一字符串变量str,并将字符串"Tom’sLivingRoom"保存到串中,则应该使用下列哪条语句()。A、string str="Tom/’s Living Room";B、string str="Tom’s Living Room";C、string str("Tom’s Living Room");D、string str("Tom"s Living Room");

要声明一个长度为256个字符的定长字符串变量str,下列语句正确的是()A、dim str as stringB、dim str as string(256)C、dim str as string[256]D、dim str as string*256

顺序执行下列程序语句后,则b的值是() String str = "Hello"; String b = str.substring(0,2);A、HelloB、helloC、HeD、null

Given the following code fragment:      1) String str = null;  2) if ((str != null)  (str.length()  10)) {     3) System.out.println("more than 10");     4) }  5) else if ((str != null)  (str.length()  5)) {     6) System.out.println("less than 5");     7) }  8) else { System.out.println("end"); }   Which line will cause error?()    A、 line 1B、 line 2C、 line 5D、 line 8

java中 String str = "hello world"下列语句错误的是()。A、str+=’ a’B、int strlen = str.lengthC、str=100D、str=str+100

Which expressions are correct to declare an array of 10 String objects? ()   A、 char str[];B、 char str[][];C、 String str[];D、 String str[10];

public static void main(String[]args){ String str="null"; if(str==null){ System.out.println("null"); }else(str.length()==0){ System.out.println("zero"); }else{ System.out.println("some"); } } What is the result?()A、nullB、zeroC、someD、Compilationfails.E、Anexceptionisthrownatruntime.

单选题Which expressions are correct to declare an array of 10 String objects? ()A char str[];B char str[][];C String str[];D String str[10];

单选题Given the following code fragment:      1) String str = null;  2) if ((str != null)  (str.length()  10)) {     3) System.out.println("more than 10");     4) }  5) else if ((str != null)  (str.length()  5)) {     6) System.out.println("less than 5");     7) }  8) else { System.out.println("end"); }   Which line will cause error?()A line 1B line 2C line 5D line 8

单选题public static void main(String[] args) {  String str = “null‟;  if (str == null) {  System.out.println(”null”);  } else (str.length() == 0) {  System.out.println(”zero”);  } else {  System.out.println(”some”);  }  }  What is the result?()A nullB zeroC someD Compilation fails.E An exception is thrown at runtime.

单选题public static void main(String[]args){ String str="null"; if(str==null){ System.out.println("null"); }else(str.length()==0){ System.out.println("zero"); }else{ System.out.println("some"); } } What is the result?()AnullBzeroCsomeDCompilationfails.EAnexceptionisthrownatruntime.

单选题若有定义语句:char str1[] = "string", str2[8], *str3, str4[10] = "string";库函数strcpy的功能是复制字符串,以下选项中错误的函数调用是(  )。Astrcpy(str3, "HELLO!");Bstrcpy(str2, "HELLO!");Cstrcpy(str1, "HELLO!");Dstrcpy(str4, "HELLO!");