CuriousTab
Search
CuriousTab
Home
Aptitude
Computer
C Programming
C# Programming
C++ Programming
Database
Java Programming
Networking
Engineering
Biochemical Engineering
Biochemistry
Biotechnology
Chemical Engineering
Civil Engineering
Computer Science
Digital Electronics
Electrical Engineering
Electronics
Electronics and Communication Engineering
Mechanical Engineering
Microbiology
Technical Drawing
GK
Current Affairs
General Knowledge
Reasoning
Data Interpretation
Logical Reasoning
Non Verbal Reasoning
Verbal Ability
Verbal Reasoning
Exams
AIEEE
Bank Exams
CAT
GATE
IIT JEE
TOEFL
Jobs
Analyst
Bank PO
Database Administrator
IT Trainer
Network Engineer
Project Manager
Software Architect
Discussion
Home
‣
Interview
‣
Technology
Comments
Question
Can a source file contain more than one class declaration?
Correct Answer
Yes a single source file can contain any number of Class declarations but only one of the class can be declared as public
Technology problems
Search Results
1. Does the order of public and static declaration matter in main() method?
Show Answer
Scratch Pad
Discuss
Correct Answer: No It doesn't matter but void should always come before main()
2. Can a main() method be declared final?
Show Answer
Scratch Pad
Discuss
Correct Answer: Yes Any inheriting class will not be able to have it's own default main() method
3. What is the argument of main() method?
Show Answer
Scratch Pad
Discuss
Correct Answer: main() method accepts an array of String object as arguement
4. What is the return type of the main() method?
Show Answer
Scratch Pad
Discuss
Correct Answer: Main() method doesn't return anything hence declared void
5. Why is the main() method declared static?
Show Answer
Scratch Pad
Discuss
Correct Answer: main() method is called by the JVM even before the instantiation of the class, hence it is declared as static
6. Which package is imported by default?
Show Answer
Scratch Pad
Discuss
Correct Answer: javalang package is imported by default even without a package declaration
7. Can a class be declared as protected?
Show Answer
Scratch Pad
Discuss
Correct Answer: A class can't be declared as protected only methods can be declared as protected
8. What is the purpose of declaring a variable as final?
Show Answer
Scratch Pad
Discuss
Correct Answer: A final variable's value can't be changed final variables should be initialized before using them
9. I do not want my class to be inherited by any other class. What should i do?
Show Answer
Scratch Pad
Discuss
Correct Answer: You should declared your class as final But you can't define your class as final, if it is an abstract class A class declared as final can't be extended by any other class
10. When will you define a method as static?
Show Answer
Scratch Pad
Discuss
Correct Answer: When a method needs to be accessed even before the creation of the object of the class then we should declare the method as static
Comments
There are no comments.
Enter a new Comment
Save
More in Interview:
Accounting and Finance
Administrative Assistant
Advertising and Media
Call Center
Common Interview
Competency Interview
Customer Service
Design and Fashion
Finance
Hospitality
Human Resources
Law
Leadership and Management
Manufacturing
Marketing and Sales
Medical and Health Care
Medical Assistant
Retail
Technology