Log In Register

Units


Class Fundamentals & Declaring Objects - Questions and Answers

 

Practice these Class Fundamentals & Declaring Objects under Java Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Class Fundamentals & Declaring Objects for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Class Fundamentals & Declaring Objects of Java Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge Java Programming specifically Class Fundamentals & Declaring Objects.
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Class Fundamentals & Declaring Objects under Java Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Class Fundamentals & Declaring Objects topic of Java Programming:

 

1. Which of these statement is incorrect?

Answer: Option A

Explanation:
Every class does not need to have a main() method, there can be only one main() method which is made public.

2. Which of these keywords is used to make a class?

Answer: Option A

Explanation:

3. What is the stored in the object obj in following lines of code? box obj;

Answer: Option B

Explanation:
Memory is allocated to an object using new operator. box obj; just declares a reference to object, no memory is allocated to it hence it points to NULL.

4. Which of the following is a valid declaration of an object of class Box?

Answer: Option A

Explanation:

5. Which of these operators is used to allocate memory for an object?

Answer: Option C

Explanation:
Operator new dynamically allocates memory for an object and returns a reference to it. This reference is address in memory of the object allocated by new.