Java Programming Questions & Answers: part13



Software Programming : Java Programming QUESTIONS AND ANSWERS :: part13 : 11 to 15

Following Software Programming language Entrance Multiple choice objective type questions and answers will help you in Software Programming 2024 examinations :

11.What is the output for y? int y = 0; for (int i = 0; i<10; ++i) { y += i; } System.out.println(y);

10
11
12
13
45.

12.Which of the following is not a valid statement?

Instance methods can access instance variables and instance methods directly
Instance methods can access class variables and class methods directly
Class methods can access class variables and class methods directly
Class methods can access instance variables or instance methods directly
Class methods cannot use ‘this’ keyword as there is no instance for this to refer to.

13.Which of the following is/are valid comment(s) in java?

/** comment */
/* comment */
/* comment
// comment
Both (opt1) and (opt2).

14.What is the correct order of defining a Class? #1. The name of the class's parent (super class), if any, preceded by the keyword extends. A class can only extend (subclass) one parent. #2. The class name, with the initial letter capitalized by convention. #3. Modifiers such as public, private, and a number of others that you will encounter later. #4. The class body, surrounded by braces, {}. #5. A comma-separated list of interfaces implemented by the class, if any, preceded by the keyword implements. A class can implement more than one interface.

3,1,2,5,4
1,2,3,5,4
3,2,1,5,4
5,1,2,3,4
5,4,3,2,1.

More Java Programming QUESTIONS AND ANSWERS available in next pages

    Health is the greatest gift, contentment is the greatest wealth -Buddha
Opportunity is missed by most people because it is dressed in overalls and looks like work.- Thomas Edison