1/27/2015
Java Interview Questions | GeekInterview.com
State true or false :- Character literals
are stored as unicode characters.
Java Interview Questions
A) TrueB) False
javec
Jan 19th, 2015
A
sumam
May 7th, 2012
True
Select Best Answ er
JUL
31
2006
Answ er Question
Public static void main(String argv) what
is wrong in the above main declaration?
S.N.Prasath
Java Interview Questions
Pulkit
11:19 AM
2232
Views
6
Ans
Jan 6th, 2015
As I can see this the P is capital in Public which is wrong.
As Java is case sensitive we should always user public
which is a key word in java and not Public.
vinay
Dec 5th, 2014
Public static void main(string argv) is question but we
have to write (string args[]) this is correct
Select Best Answ er
AUG
25
2004
Answ er Question
What is the preferred size of a
component
Java Interview Questions
The preferred size of a component is the minimum component size
that will allow thecomponent to display normally.
data:text/html;charset=utf-8,%3Cul%20class%3D%22media-list%22%20style%3D%22padding%3A%200px%3B%20margin%3A%200px%3B%20font-weight
1/11
1/27/2015
09:47 PM
Java Interview Questions | GeekInterview.com
anup v pachghare
Jan 2nd, 2015
2287
Views
2
Ans
The minimum size of the component, enough to display
its label is known as preferred size of the
component. The FlowLayout manager gives the
preferred size to a component.
hehe
Oct 26th, 2007
The preferred size of a component is the minimum
component size that will
allow the component to display normally.
Select Best Answ er
DEC
10
2005
08:32 AM
Answ er Question
Which of the following is not a wrapper
class?
Java Interview Questions
A) StringB) IntegerC) BooleanD) Character
Munish Kumar
Jan 3rd, 2015
3668
Views
11
Ans
String because string is not a primitive datatype. Only the
primitive datatypes has wrapper classes.
rajkumari patel
Dec 26th, 2014
Boolean
Select Best Answ er
JUL
18
2007
Answ er Question
What is the default size of Vector,
Arraylist, Hashtable, Hashmap, Hashset
in Java?
V.shankar
Java Interview Questions
06:51 AM
data:text/html;charset=utf-8,%3Cul%20class%3D%22media-list%22%20style%3D%22padding%3A%200px%3B%20margin%3A%200px%3B%20font-weight
2/11
1/27/2015
15601
Views
10
Ans
Java Interview Questions | GeekInterview.com
Saurabh Ranjan
Jan 1st, 2015
After 10th element if we insert 11th element in ArrayList it
will increase by capacity=(currentCapacity*3/2)+1
manju
Mar 3rd, 2014
16
Select Best Answ er
AUG
25
2004
09:47 PM
531
Views
Answ er Question
Which characters may be used as the
second character of an identifier,but not
as the first character of an identifier
Java Interview Questions
The digits 0 through 9 may not be used as the first character of an
identifier but they maybe used after the first character of an
identifier.
rajkumari
Dec 26th, 2014
1
Ans
String
Select Best Answ er
DEC
10
2005
08:33 AM
Answ er Question
_____________ is the process by which
one object acquires the properties of
another object
Java Interview Questions
A) EncapsulationB) ClassC) InheritenceD) Polymorphism
1682
Views
4
Ans
data:text/html;charset=utf-8,%3Cul%20class%3D%22media-list%22%20style%3D%22padding%3A%200px%3B%20margin%3A%200px%3B%20font-weight
3/11
1/27/2015
Java Interview Questions | GeekInterview.com
Zhu
Dec 24th, 2014
Inheritance
siri
Jul 30th, 2011
Inheritance
Select Best Answ er
JAN
Answ er Question
what is HashCode in Java
27
divya
Java Interview Questions
Abhisek
2006
Dec 23rd, 2014
Hashcode is nothing but Index of the Address of the
Object. Hashcode is integer value.which would be
automatically generated by JVM. whenever an object is
created & address is generated,JVM pick up o...
05:47 AM
19176
Views
Michael Wu
18
Oct 4th, 2011
Ans
Originally hash code is translate memory address to int. I
want to propose a question why java designed a
hashcode? It is just for distinguish two object?
Select Best Answ er
DEC
Answ er Question
Predict the output of the given code:
15
javapublic class Test {
2012
private static String msg = "HCL ";
lalithakasiraj
Java Interview Questions
static{
12:44 AM
Thread t = new Thread(new Runnable(){
public void run(){
5087
msg = "Technologies ";
Views
}
});
data:text/html;charset=utf-8,%3Cul%20class%3D%22media-list%22%20style%3D%22padding%3A%200px%3B%20margin%3A%200px%3B%20font-weight
4/11
1/27/2015
20
Ans
Java Interview Questions | GeekInterview.com
t.start();
}
public static void main(String[] args){
System.out.print(msg);
}}
a) Compiles and prints HCL
b) Compiles and prints Technologies
c) Compiles and...
ankit
Dec 19th, 2014
Answer is coming as HCL because there are two threads
main and t and both are sharing the common resource (
static variable msg ) . Thread t is getting created and
brought into runnable state ( by ca...
prabhash
Sep 26th, 2014
Compile and print HCL
Select Best Answ er
NOV
26
2014
12:11 PM
Answ er Question
Write a program that reads from the
user an integer and prints it until the
user enters 0
samah501
Java Interview Questions
Himu
Dec 5th, 2014
595
Views
1
Ans
"java import java.util.Scanner; public class test { public
static void main(String[] args) { int f=1;
System.out.println("Enter any number. Press 0 to
exit...."); ...
Select Best Answ er
SEP
12
Answ er Question
What are the types of exceptions in
java?
nithya
Java Interview Questions
data:text/html;charset=utf-8,%3Cul%20class%3D%22media-list%22%20style%3D%22padding%3A%200px%3B%20margin%3A%200px%3B%20font-weight
5/11
1/27/2015
2005
Java Interview Questions | GeekInterview.com
Pritam khandal
Nov 29th, 2014
05:14 AM
29860
Views
18
Ans
There are 2 Broad categories, 1. Checked Exception ->
Occurs while prg execution. Eg) File not found 2.
UnChecked Exception -> Its not reasonable. Occurs at
runtime. Eg) Accessing End of an array....
Pyae Arkar Naing
Jun 24th, 2014
1-> The Checked Exceptions 2-> Errors 3-> Runtime
Exceptions Otherwise Errors and Runtime Exceptions fall
into the category of unchecked exceptions. Therefore, the
types of exceptions in JA...
Select Best Answ er
MAY
25
2013
Answ er Question
Java code to set column width in CSV
file
19sw apna84
Java Interview Questions
Can someone help on how to set the column width in CSV file
using javacode.
12:22 PM
I have used FileWriter class to upload data into the csv file. Results
3520
are getting populated properly but csv file showing results with
Views
default column width. Is there a way we can set the width of the
column dynamically based on result length or set fixed length?
Ans
data:text/html;charset=utf-8,%3Cul%20class%3D%22media-list%22%20style%3D%22padding%3A%200px%3B%20margin%3A%200px%3B%20font-weight
6/11
1/27/2015
Java Interview Questions | GeekInterview.com
Dusmanta
Nov 12th, 2014
Use Apachae POI jar for this HSSFSheet sheet =
workBook.createSheet("testXls");
Code
1. // Code to Auto size the column widths
2.
for(int
osition<
5;
3.
columnPosition =
columnPosition++)
0;
columnP
sheet.autoSiz
((short) (c
ol
umnPosition));
4.
Abhishek Mishra
Oct 8th, 2014
Account,LastName,FirstName,Balance,CreditLimit,AccountCreated,Rating
101,Reeves,Keanu,9315.45,10000.00,1/17/1998,A
312,Butler,Gerard,90.00,1000.00,8/6/2003,B
868,Hewitt,Jennifer Love,0,17000.00,5/25/1...
Select Best Answ er
DEC
10
2005
08:32 AM
Answ er Question
Which of the following classes is used to
perform basic console I/O?
Java Interview Questions
A) SystemB) SecurityManagerC) MathD) Runtime
halo
Nov 10th, 2014
819
A) System
Views
1
Select Best Answ er
Answ er Question
Ans
JUL
10
JUnit
sunil79
Java Interview Questions
What is JUnit and how it is used?
2012
data:text/html;charset=utf-8,%3Cul%20class%3D%22media-list%22%20style%3D%22padding%3A%200px%3B%20margin%3A%200px%3B%20font-weight
7/11
1/27/2015
02:28 AM
Java Interview Questions | GeekInterview.com
Satendra Kumar
Nov 10th, 2014
1016
Views
JUnit is primary testing which is done by programmer to
ensure that my code is a quality code.
we can used unit testing by creating test cases ........
3
Ans
Abhishek Mishra
Oct 10th, 2014
"java import org.junit.*; public class TestFoobar {
@BeforeClass public static void setUpClass() throws
Exception { // Code executed before the first test method
...
Select Best Answ er
OCT
Answ er Question
Python programming
23
How do i write a module to keep count of the amount of guesses it
2012
takes to guess the number correctly?
03:41 PM
1416
Views
1
robert25
Java Interview Questions
Abhishek Mishra
Oct 8th, 2014
"c # This is a guess the number game. import random
guessesTaken = 0 print(Hello! What is your name?)
myName = input() number = random.randint(1, 20)
print(Well, + myName + , I am...
Ans
Select Best Answ er
AUG
18
2014
Answ er Question
Explain White box testing related to Java
?
RoshanC
Java Interview Questions
01:43 PM
2445
Views
data:text/html;charset=utf-8,%3Cul%20class%3D%22media-list%22%20style%3D%22padding%3A%200px%3B%20margin%3A%200px%3B%20font-weight
8/11
1/27/2015
2
Ans
Java Interview Questions | GeekInterview.com
Abhishek Mishra
Oct 5th, 2014
White Box Testing is a software testing method in which
the internal structure/design/implementation of the item
being tested is known to the tester. The tester chooses
inputs to exercise paths throug...
ABHISHEK MISHRA
Oct 5th, 2014
White box testing is the detailed investigation of internal
logic and structure of the code. White box testing is also
called glass testing or open box testing. In order to
perform white box testing o...
Select Best Answ er
DEC
10
2005
Answ er Question
In order for a source code file,
containing the public class Test, to
successfully compile, which of the
following must be true?
Java Interview Questions
08:32 AM
A) It must have a package statementB) It must be named
2522
Test.javaC) It must import java.langD) It must declare a public
Views
class named Test
4
Ans
Jitender Singal
Sep 27th, 2014
D) it must declare a public class named test
tien
Jul 29th, 2014
C) It must import java.lang
Select Best Answ er
DEC
10
Answ er Question
What are the two types of multitasking?
1. Process-based2. Thread-based
data:text/html;charset=utf-8,%3Cul%20class%3D%22media-list%22%20style%3D%22padding%3A%200px%3B%20margin%3A%200px%3B%20font-weight
9/11
1/27/2015
2005
08:32 AM
Java Interview Questions | GeekInterview.com
Java Interview Questions
A) 1B) 2C) Both 1,2D) None of the above
neha
Sep 9th, 2014
1720
Views
Its both , ie option C .
mohanapriya
4
Ans
Sep 27th, 2011
Both process based and thread based.......
two types of multitasking are thread based and process
based multitasking
Select Best Answ er
JUL
16
2007
Answ er Question
When object is created in Java. Is it
during compile time or run time?
vishalaxi Sajjan
Java Interview Questions
Keshav v. devale
08:21 AM
2623
Aug 31st, 2014
Array of object created on run time
Because user assigned values by runtime
Views
apgangw ar
Jun 17th, 2010
Ans
It is created on run time
Select Best Answ er
SEP
09
2005
Answ er Question
What is the difference between the >>
and >>> operators
Java Interview Questions
The >> operator carries the sign bit when shifting right. The >>>
zero-fills bits that havebeen shifted out.
06:25 AM
data:text/html;charset=utf-8,%3Cul%20class%3D%22media-list%22%20style%3D%22padding%3A%200px%3B%20margin%3A%200px%3B%20font-weight
10/11
1/27/2015
5254
Views
4
Ans
Java Interview Questions | GeekInterview.com
Suraj Patil
Aug 16th, 2014
When you deals with >> operator, only shifting is done by
moving count times towards right without any
replacement by zero. but when you deals with >>>
operator them like >> this operator but only di...
infant
Oct 5th, 2005
While dealing with (+)ve numbers there is no difference
between >>> and >> operators.Both operators shift
zeros into the upper bits of a number.The difference
arises when dealing with (...
data:text/html;charset=utf-8,%3Cul%20class%3D%22media-list%22%20style%3D%22padding%3A%200px%3B%20margin%3A%200px%3B%20font-weight
11/11