Nanjing University of Posts and Telecommunications Java programming job on-line programming eighth time

Source: Internet
Author: User

Tags: stat row public suffix name abstract code load program work


Work platform of programming class course

    • Wang Li

    • Home
    • Teaching Resources
    • My list of jobs
    • Programming class
    • Account
Wang Li "Java language programming 8th time Job (2018)" Detailed
    1. Home
    2. My list of jobs
    3. Job Result Details
Score: 100 Selection score: 701. int[][] a=new int[2][3], then the array contains () the number of elements. a.2b.3c.6d. Not sure the correct answer is: C2. The known class person is the parent of the class student, and the following array definition and assignment is correct (). A.person P[]=new person[3]; P[1]=new student (); B.student S[]=new person[3]; S[1]=new person (); C.person p[]= New student[3];p [1]= new Person ();D. Student S[]=new student[3];s[1]=new person; the correct answer is: a3. The following statement about classes in Java is incorrect (). A. The class body contains definitions of variable definitions and Member methods B. Constructors are special methods in classes C. Classes must be declared public before they can be executed d. A Java file can have multiple class definitions with the correct answer: C4. The following statement about the interface is correct (). A. All methods that implement an interface must implement an interface B. There cannot be an inheritance relationship between interfaces c. A class can implement only one interface D. Interfaces and abstract classes are the same thing the correct answer is: A5. The following statement about the construction method is correct (). A. The construction method of a class can have more than one B. Construction method can not overload C. The constructor method can have a return value of D. The construction method can have the same name as the class, or it can be different from the class name the correct answer is: A6. In the following discussion, the error is (). The suffix name of the A.java source code is. java. B.java each class in the source code is compiled and generates a. class file. C. Only one class can be defined in a file named A.java. Classes and interfaces can be defined in the D.java source code. The correct answer is: C7. In the following discussion, it is correct (). A. Abstract methods are methods that do not have a method body. B. Abstract methods must exist in abstract classes. C. Abstract methods must be included in the abstract class. D. Abstract classes can create objects. The correct answer is: A8. The MyClass class is defined as follows: Class myclass{public MyClass (int x) {}} creates the object in the following way () is correctA.myclass myobj=new MyClass; B.myclass myobj=new MyClass (); C.myclass myobj=new MyClass (1);D. MyClass myobj=new MyClass; the correct answer is: C9. About method void fjv (int x,int y) {}, the following () cannot be an overload of it. A.void fjv (int x,float y) {}b.void fjv (int x) {}c.void fjv (float x,int y) {}d.int fjv (int y,int x) {} The correct answer is: D10. The following () statement is incorrectA. Instance variables are declared with the static keyword; B. The instance variable is a member variable of the class; C. The method variable can be created when the method executes; D. The method variable must be initialized before it is used; the correct answer is: a11. If a method is modified to be a ________ method, this method cannot be overridden. A.finalb.staticc.voidd.protected the correct answer is: A12. In Java, the following statement is correct (). A. A subclass can have more than one parent class, and a parent class can have many child classes B. A subclass can have more than one parent class, but a parent class can have only one subclass C. A subclass can have a parent class, but a parent class can have more than one subclass D. The correct answer is: C13. The ___________ variable has only one copy in memory and is shared by all objects of that class. A. Member B. Local C. Global d. Class The correct answer is: DMax_length is a public member variable of type int, the value of the variable remains constant 100, and the following sentence defines the statement as correct. a.public int max_length=100; b.final int max_length=100; c.final public int max_length=100;d.public final int max_length=100; Correct answer is: D program fill in the blanks score: 30using abstract classes to define pets

Create an abstract pet (PET) and use this class to program
1) Create pet class, including the member has the name, and is the private type;
2) define the GetName () and SetName (string name) member methods for the pet class, declaring an abstract method String shout ();
3) Create two subclasses of the pet class, Dog and Cat respectively, declare the constructor for these two classes, and call the parent class's SetName method in the constructor of the subclass to set the pet's name;
4) different shout methods are implemented in subclasses, in which the Shout method of dog returns "Wang Wang Wang", and the Shout method of cat returns "Miao Miao Miao";

//write the main class, generate several instances and verify the functionality of the program, and do not alter the definition of the main class.  Public classmain{ Public Static voidMain (string[] args) {Pet Pet=NewDog ("Wangcai"); System.out.println (Pet.getname ()+":"+pet.shout ()); Pet=NewCat ("Xiaohua"); System.out.println (Pet.getname ()+":"+pet.shout ()); }}//Please add your code content after the bankAbstract classpet{PrivateString name;  PublicString GetName () {returnname; }     Public voidsetName (String name) { This. Name =name; }    AbstractString shout ();}classDogextendspet{Dog (String name) {setName (name); } @Override String Shout () {return"Wang Wang Wang"; }}classCatextendspet{Cat (String name) {setName (name); } @Override String Shout () {return"Miao Miao Miao"; }}

Nanjing University of Posts and Telecommunications Java programming job on-line programming eighth time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: