Set - 3

Question 31 :

How to add menushortcut to menu item?

Answer :

If you have a button instance called aboutButton, you may add menu short cut by calling aboutButton.setMnemonic('A'), so the user may be able to use Alt+A to click the button.

Question 32 :

In System.out.println(),what is System,out and println,pls explain?

Answer :

System is a predefined final class,out is a PrintStream object acting as a field member and println is a built-in overloaded method in the out object.

Question 33 :

Can you write a Java class that could be used both as an applet as well as an application?

Answer :

Yes. Add a main() method to the applet.

Question 34 :

Can you make an instance of an abstract class? For example - java.util.Calender is an abstract class with a method getInstance() which returns an instance of the Calender class.

Answer :

No! You cannot make an instance of an abstract class. An abstract class has to be sub-classed. If you have an abstract class and you want to use a method which has been implemented, you may need to subclass that abstract class, instantiate your subclass and then call that method.

Question 35 :

What is the output of 

x > y? a:b = p*q when x=1,y=2,p=3,q=4?

Answer :

When this kind of question has been asked, find the problems you think is necessary to ask back before you give an answer. Ask if variables a and b have been declared or initialized. If the answer is yes. You can say that the syntax is wrong. If the statement is rewritten as: x