回家作業一
bytecode: It translate your Java program into a language.
JVM:Bytecode is the machine language for a fictitious computer.
class:A java program is givided into smaller parts.
object:Object-oriented programming has its own specialized terminology.
3. Let i=2;
Print i;
Print 2 * (i++);
Print i;
Ans: 2, 4, 3.
public class generalwu {
public static void main(String[] arg) {
int i=2,x;
System.out.println(""+i);
x=2*(i++);
System.out.println(""+x);
System.out.println(""+i);
}
}
4. Let i=2;
Print i;
Print 2 * (++i);
Print i;
Ans: 2, 6, 3
public class generalwu {
public static void main(String[] arg) {
int i=2,x;
System.out.println(""+i);
x=2*(++i);
System.out.println(""+x);
System.out.println(""+i);
}
}
5. Let m=7, n=2;
Print (double) m/n;
Print m/ (double)n;
Ans: 3.5, 3.5
public class generalwu {
public static void main(String[] arg) {
int l=2,m=7;
System.out.println((double)m/l);
System.out.println(m/(double)l);
}
}
0 Comments:
发表评论
<< Home