Java objective type questions and answers on static keyword
Posted by: Instanceofjava Posted date: 8:46 PM / comment : 0 core java multiple choice questions with answers
1.Static means
Class level
Object level
Wrong
Correct
Static keyword is mainly used for memory management.Static variables get memory when class loading itself
2.Main method is static because to execute main method without creating object By JVM
Yes
No
Wrong
Correct
In order to execute a method without creating object we need to declare that method as static. To call main method there is no need og=f object so it is static.
3.We can overload static methods
True
False
Wrong
Correct
Read more @ Can we overload static methods in java
4.We can override static methods
Yes
No
Wrong
Correct
Read more @ Can we override static methods in java
5.Can we write static public void main(String [] args)?
Yes
No
Wrong
Correct
Yes we can define main method like static public void main(String[] args){}
Order of modifiers we can change
x=10 x=10
x=10 x=20
x=30 x=30
x=30 x=20
Wrong
Correct
Static means class level. and we can access through not static methods also. But it is not part of object.