• 2022-06-08
    public class Increment{ public static void main(String args[]) { int a; a = 6; System.out.print(a); System.out.print(a++); System.out.print(a); } }以上程序的运行结果是【 】
    A: 666
    B: 667
    C: 677
    D: 676
  • B

    内容

    • 0

      下列程序的运行结果是()。 public class Test public static void main ( String [ ] args ) int count = 0 for( int i = 1 i < 5 i = 2) for( int j = 1 j< = 10 j = 3) count System .out .print (count ) _

    • 1

      以下顺序结构语句的运行结果是:( )int a;a=6;System.out.print(a);System.out.print(++a);System.out.print(a); A: 666 B: 667 C: 677 D: 676

    • 2

      以下代码运行后会是哪个结果():int a;<br/>a = 6;<br/>System.out.print(a);<br/>System.out.print(a++);<br/>System.out.print(a); A: 676 B: 666 C: 677 D: 667

    • 3

      import java.io.*; class Person{ public void print(){System.out.print("Person ");} public void printMyGender(String s){ this.print(); System.out.print(s+" "); } } class Gender{ String type="gender"; public void print(Person p){p.printMyGender(type);} } class Female extends Gender{ public Female(){ type="female"; } } class Male extends Gender{ public Male(){ type="male"; } } class Employee extends Person{ public void print(){ System.out.print("Employee ");} } class Manager extends Employee{ public void print(){ System.out.print("Manager ");} } public class Test{ public static void main(String[] args){ Manager man = new Manager(); Employee em = new Employee(); Gender gender1 = new Male(); Gender gender2 = new Female(); gender1.print(man); gender2.print(em); } } 对于以上代码,其运行结果是

    • 4

      请写出以下程序运行结果: public class Main { public Main() { System.out.print("main "); } public Main(String s) { this(); System.out.print("main with "+s); } public static void main(String[] args) { Main main = new Main("wow"); } }