Java2 Practical Tutorial Sixth Edition Exercise Answers

Java2 Practical Tutorial Sixth Edition Exercise Answers

The matching experiment book has the answer at the end, if there is a book, flip the book, if there is no book, I will post the answer later

Chapter One

1. True or False

✔××✔×××

2. Multiple choice questions

BDACC

3. Pick the wrong question

DAB (the second question is correct in the book, but public is public in the exercise bank, and A is selected in the exercise bank)

4. Reading program questions

(1)Speak.java

(2)2个 Speak.class Xiti4.class

(3) Hit4

(4) No class method found in class Speak

Exercise two:

×✔✔×✔ ✔✔✔××

Multiple choice BACAD BBD

False Picking DABC

Reading program questions

1. low

2.

                                                                                                                                                     3. 

4.      4   1

5.40 20

5. Programming questions

public class e {
    public static void main(String[] args) {
        char a='你';
        char b='我';
        char c='他';
        System.out.println("你:"+(int)a);
        System.out.println("我:"+(int)b);
        System.out.println("他:"+(int)c);
    }

}


public class e {
    public static void main(String[] args) {
     char a='α';
     for(int i=0;i<24;i++)
     {
         char b=a;
         System.out.println(b);
         a++;
     }
    }

}

                                                    Exercise three    

1. ×✔✔×✔ ✔✔✔×× The first question (0 and 1 in java cannot represent true and false)

2.ACBCCC

3. DBD

Four

1. You, apple, sweet

2. Jep is good

3.x=-5y=-1

five.

       1.

public class e {
    public static void main(String[] args) {
        int total=0;
        for(int i=1;i<=10;i++)
        {
            total+=jiecheng(i);
        }
        System.out.println(total);
    }

    public static int jiecheng(int i) {
        int temp=1;
        for (;i>1;i--)
        {
            temp*=i;
        }
        return temp;
    }
}

2, 3, 4 will not be typed, the basics have been compiled in other languages ​​​​before learning Java, write it yourself

5.

public class e {
    public static void main(String[] args) {
        int total=0;
        int b=8;
        for(int i=1;i<=10;i++)
        {
            total+=b;
            b=b*10+8;
        }
        System.out.println(total);
    }

}

5.

public class e {
    public static void main(String[] args) {
     int total=0;
     int  num=0;
        for(int i=1;total<8888;i++)
     {
         total+=i;
         num=i;
     }
        System.out.println(num);
    }
}

                  

Exercise four

✔✔✔×✔✔✔✔××

multiple choice

BDDDAC

pick the wrong question

BCC

Exercise five

×✔×✔× ✔✔✔××

Multiple choice questions (note that the third question is multiple choice)

C D CD D B B D B A

pick the wrong question

B D

The following chapters will be updated slowly. If there are mistakes, I hope to point them out and I will correct them in time.

Exercise six

××××✔

Multiple choice questions (note multiple choice)

D AB A

pick the wrong question

D D

output result question

15.0 8

18 15

18:12:7:6

Exercise seven

✔✔✔✔✔

××✔×✔

A B C C C

1. Hello everyone, I wish you success in your work

2.p is an interface variable

3. Hello fine thanks

4.100:101

5. I am Red Bull

Exercise eight

✔×✔×✔

✔✔✔×✔

A C B D C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/m0_52906701/article/details/120239131