下面代码输出结果是( )?(单选)
import java.io.*;
import java.util.*;
public class foo{
public static void main (String[] args){
String s;
System.out.println("s=" + s);
}
}
请使用三目运算符描述以下代码:
If(a>0){
B=1;}
eles{
B=2;
}
写出下面程序的执行结果
class HelloA {
public HelloA()
{
System.out.println( "HelloA" );
}
{ System.out.println( "I'm A class" ); }
static { System.out.println( "static A" ); }
}
public class HelloB extends HelloA {
public HelloB()
{
System.out.println( "HelloB" );
}
{ System.out.println( "I'm B class" ); }
static { System.out.println( "static B" ); }
public static void main( String[] args )
{
new HelloB();
}
}
改错题计算 1/1+1/2+1/3+...+1/100 的值
-------------------------------------------------------*/
public class Prog1
{
public static void main( String args[ ])
{
int sum=0.0;
for(int i=1; i<100; i++)
sum+=1/i;
System.out.println( "sum=",sum );
}
}
14题 | 被引用1640次