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
Does the order of public and static declaration matter in main() method?
Correct Answer
No It doesn't matter but void should always come before main()
Technology problems
Search Results
1. 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
2. What is the argument of main() method?
Show Answer
Scratch Pad
Discuss
Correct Answer: main() method accepts an array of String object as arguement
3. 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
4. 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
5. Are arrays primitive data types?
Show Answer
Scratch Pad
Discuss
Correct Answer: In Java, Arrays are objects
6. Can a source file contain more than one class declaration?
Show Answer
Scratch Pad
Discuss
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
7. Which package is imported by default?
Show Answer
Scratch Pad
Discuss
Correct Answer: javalang package is imported by default even without a package declaration
8. 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
9. 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
10. 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
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