IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C++ Programming C# Programming Java Programming
Microbiology Biochemistry Biotechnology Biochemical Engineering
Chemical Engineering Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

Java Programming - Declarations and Access Control - Discussion

@ : Home > Java Programming > Declarations and Access Control > General Questions - Discussion

Read more:

"To err is human; to forgive, divine."
- Alexander Pope
5. 

public class Test { }
What is the prototype of the default constructor?

[A]. Test( )[B]. Test(void)
[C]. public Test( )[D]. public Test(void)

Answer: Option A

Explanation:

Option A and B are wrong because they use the default access modifier and the access modifier for the class is public (remember, the default constructor has the same access modifier as the class).

Option D is wrong. The void makes the compiler think that this is a method specification - in fact if it were a method specification the compiler would spit it out.


Ashwin said: (Thu, Aug 18, 2011 07:11:37 PM)    
 
Why the option A is wrong ?
The compiler will implicitly put "public" in front of Test(). Then why this option is wrong.

And wht do you mean by prototype ?

Mahesh said: (Mon, Jan 2, 2012 12:13:26 PM)    
 
Option A is wrong. The default constructor has the same access modifier as the class. Here the is defined public so default constructor must be public. And Test() is in default access level.

The compiler will not implicitly put "public" in front of Test().

Saritha said: (Tue, Jan 31, 2012 05:53:15 PM)    
 
If the class having the access modifier as private. Then is it the default constructor of class is private?

Write your comments here:
Name *:     Email:


© 2008-2012 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Contact us: info@indiabix.com     Follow us on twitter!