-
Compareto and equals method
Difference between CompareTo and equals method.
-
There are _____ types of Comments in Java
A) One B) Two C) ThreeD) Four Explanation: There are 3 types of comments namely Single-line, Multi-line and Documentation comment
-
-
How to check the status of a caps lock key..?
You can do it without using key event, by creating an artificial key event using java.awt.Robot class to generate a "simple caracter" key press (for instance KeyEvent.VK_A). Sample Source Code -- May not be accurate but the concept is as follows. import java.awt.*;import java.awt.event.*;public class Test { public static void main(String[] args) throws AWTException...
-
Print Only Numbers From Java Strings
I have a question in Java-string,
String s="adf5hgjyu1frdsff6vgyu7bnjh9asd3"; like
How to print only numbers in that string -
What are the functions of the dot(.) operator? (Select multiple)
A) It enables you to access instance variables of any objects within a classB) It enables you to store values in instance variables of an objectC) It is used to call object methodsD) It is to create a new object
-
What is the output of the following program?
class Test{
public static void main(String [] args){
int a=8;
a=--a+a--+a++;
System.out.println(a );
}} -
-
-
What are the two types of multitasking?1. Process-based2. Thread-based
A) 1B) 2C) Both 1,2D) None of the above
-
What is the difference between an if statement and a switch statement
The if statement is used to select among two alternatives. It uses a boolean expression todecide which alternative should be executed. The switch statement is used to select among multiple alternatives. It uses an int expression to determine which alternativeshould be executed.
-
Is null a keyword
The null value is not a keyword.
-
-
Can an anonymous class be declared as implementing an interface and extending aclass
An anonymous class may implement an interface or extend a superclass, but may not bedeclared to do both.
-
-
The Java compiler requires that a source file use the ________ filename extension
A) .hB) . javaC) >javaD) .class
-
-
Which of the following declare an array of string objects? (Select Multiple)
A) String[ ] s;B) String [ ]s:C) String[ s]:D) String s[ ]:
-
-
What is the difference between a Choice and a List
A Choice is displayed in a compact form that requires you to pull it down to see the listof availablechoices. Only one item may be selected from a Choice. A List may be displayed in such away that severalList items are visible. A List supports the selection of one or more List items.
Java Interview Questions
Ans