更多"阅读下面程序 public class OperatorsAndExp"的相关试题:
[单项选择]阅读下面程序
public class OperatorsAndExpressions{
void equalsMethodl( ){
String s1=new String("how are you");
String s2=new String("how are you");
System.out.println(s1==s2);
}
public static void main(String args[]){
OperatorsAndExpressionsOperAndExp=new OperatorsAndExpressions( );
//用于复合类型数据的“==”运算符
OperAndExp.equalsMethod1( );
}
}
程序运行结果是【 】
A. =
B. TRUE
C. FALSE
D. equal
[单项选择]阅读下面程序:
public class OperatorsAndExpressions
void residual
int i=100,j=30;
float m=563.5f,n=4.0f;
System.out.println(i%j);
System.out.println(m%n):
public static void main(String args[])
OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions( );
//取模运算符在整数和浮点数中的应用
OperAndExp.residual( );
程序运行的结果是
A. 10
B. 20
C. 10
D. 20
[单项选择]
请阅读下面程序
public class OperatorsAndExpressions {
void residual( ) {
int i=100, j=30;
float m=563.5f, n=4.0f;
System.out.println(i%j);
System.out.println(m%n);
}
public static void main(String args[]) {
OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions( ); //取模运算符在整数和浮点数中的应用
OperAndExp.residual;
}
} 程序运行结果是()
A. 10 3.5
B. 20 2.5
C. 10 4.5
D. 20 3.5
[填空题]
阅读下列程序段
public class OperatorsAndExpressions {
String conditionalExpression(int score) {
String result;
//如果score超过60分, 则结果是passed, 否则是doesn’t pass
result=-(score>=60)"passed":"doesn’t pass";
System.out.println(result);
retum result;
}
public static void main(String args[]) {
OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions( );
//条件表达式
OperAndExp.conditionalExpression(65);
}
}
其执行结果是 【8】 。
[单项选择]阅读下面程序
public class Increment
public static void main(stringargs[])
int c;
c=5:
System.out.println(c);
System.out.println(c++);
System.out.println(c);
程序运行结果是( )。
A. 5
B. 5
C. 6
D. 6
[单项选择]阅读下面程序
public class Test3
public static void main(String args[])
int x=3, y=4, z=5;
String s="xyz";
System.out.primln(s+x+y+z);
程序运行的结果是
A. xyzl2
B. xyz345
C. xyzxyz
D. 12xyz
[单项选择]
阅读下面程序
public class My Val{
public static void main(String args[]){
My Val m=new My Val( );
m. amethod( );
}
public void amethod( ){
boolean b[]=new Boolean[5];
}
}
程序编译或运行结果是()
A. 1
B. null
C. " "
D. 编译不能过
[单项选择]阅读下面程序
publicclass Operators AndExpressions
voidequalsMethodl( )
Strings1=newString("howareyou");
Strings2=newString("howareyou");
System.out.println(s1==s2);
publicstaticvoidmain(Stringargs[])
OperatorsAndExpressionsOperAndExp=newOperatorsAndExpressions
( );
//用于复合类型数据的“==”运算符
OperAndExp.equalsMethodl( );
程序运行结果是( )。
A. ==
B. true
C. false
D. equal
[单项选择]阅读下面程序
public class Increment {
public static void main( String args[] ){
int c;
c=5;
System.out.println(C) ;
System.out.println(c++);
System.out.println(C) ;
}
}
输出结果是【 】
A. 5 6 6
B. 5 5 6
C. 6 7 7
D. 6 6 6
[单项选择]阅读下面程序 public void test( ) { try{ sayHello( ); System.out.println("hello"); } catch(ArrayIndexOutOfBoundException e) { System.out.println("ArrayIndexOutOfBoundException"); } catch(Exception e) { System.out.println("Exception"); } finally { System.out.println("finally");} } 如果sayHello( )方法正常运行,则test( )方法的运行结果将是
A. Hello
B. ArraylndexOutOfBondsException
C. Exception Finally
D. Hello Finally
[单项选择]请阅读下面程序
public class ExampleStringBuffer
public static void main (String[]args)
StringBuffer sb=new StringBuffer("test");
System.out.printIn("buffer="+sb);
System, out.printIn("length="+sb.length( ));
程序运行结果中在“length=”后输出的值是______。
A. 10
B. 4
C. 20
D. 30
[单项选择]阅读下面程序
public class Test implements Runnable
public static void main(String[]args)
_______________________________________;
t. start( );
public void mR( )
System. out. println("Hello!");
}
在程序下画线处填入正确选项是
A. Test t=flew Test()
B. Thread t=new Thread();
C. Thread t=new Thread(new Test());
D. Test t=new Thread();