com
TOP 100
JAVA
hirist
.com
QUESTION 1
QUESTION
ANSWER
Yes. Java is a platform independent language. We can write java code on one platform and run it on another
platform. For e.g. we can write and compile the code on windows and can run it on Linux or any other supported
platform. This is one of the main features of java.
hirist
.com
QUESTION 2
QUESTION
ANSWER
a)Class(Method) Area
b)Heap,
c) Stack,
d)Program Counter Register and
e)Native Method Stack
hirist
.com
QUESTION 3
QUESTION
What is class?
ANSWER
Class is nothing but a template that describes the data and behavior associated with instances of that class
hirist
.com
QUESTION 4
QUESTION
ANSWER
Yes. A .java file contain more than one java classes, provided at the most one of them is a public class.
hirist
.com
QUESTION 5
QUESTION
ANSWER
byte 8 bit (are esp. useful when working with a stream of data from a network or a file).
short 16 bit
hirist
.com
QUESTION 6
QUESTION
ANSWER
To create a conversion between two incompatible types, we must use a cast. There are two types of casting in java:
automatic casting (done automatically) and explicit casting (done by programmer).
hirist
.com
QUESTION 7
QUESTION
ANSWER
Inheritance
Polymorphism
Data Encapsulation
Abstraction
hirist
.com
QUESTION 8
QUESTION
ANSWER
Method overloading in Java occurs when two or more methods in the same class have the exact same name, but
different parameters. On the other hand, method overriding is defined as the case when a child class redefines
the same method as a parent class. Overridden methods must have the same name, argument list, and return
type. The overriding method may not limit the access of the method it overrides
hirist
.com
QUESTION 9
QUESTION
ANSWER
Binding refers to the linking of method call to its body. A binding that happens at compile time is known as static
binding while binding at runtime is known as dynamic binding.
10
hirist
.com
QUESTION 10
QUESTION
11
hirist
.com
QUESTION 11
QUESTION
What is difference between Array and ArrayList ? When will you use Array
over ArrayList ?
ANSWER
The Array and ArrayListclasses differ on the following features:
a. Arrays can contain primitive or objects, while an ArrayList can contain only objects.
12
hirist
.com
QUESTION 12
QUESTION
What is OOPs?
ANSWER
Object oriented programming organizes a program around its data i,e. objects and a set of well defined interfaces to
that data. An object-oriented program can be characterized as data controlling access code
13
hirist
.com
QUESTION 13
QUESTION
What is Casting?
ANSWER
Casting is used to convert the value of one type to another.
14
hirist
.com
QUESTION 14
QUESTION
ANSWER
Just-In-Time(JIT) compiler:It is used to improve the performance. JIT compiles parts of the byte code that have
similar functionality at the same time, and hence reduces the amount of time needed for compilation.Here the
term compiler refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set
of a specific CPU.
15
hirist
.com
QUESTION 15
QUESTION
What is the main difference between Java platform and other platforms?
ANSWER
The Java platform differs from most other platforms in the sense that it's a software-based platform that runs on top
of other hardware-based platforms. It has two components:
1. Runtime Environment
2. API(Application Programming Interface)
16
hirist
.com
QUESTION 16
QUESTION
ANSWER
Constructors are used for creating an instance of a class, they are invoked when an instance of class gets created.
Constructor name and class name should be same and it doesnt have a return type
17
hirist
.com
QUESTION 17
QUESTION
ANSWER
Default: Constructors with no arguments are known as default constructors, when you dont declare any constructor
in a class, compiler creates a default one automatically.
Parameterized: Constructor with arguments are known as parameterized constructors.
18
hirist
.com
QUESTION 18
QUESTION
ANSWER
Aggregation represents weak relationship whereas composition represents strong relationship. For example: bike
has an indicator (aggregation) but bike has an engine (compostion).
19
hirist
.com
QUESTION 19
QUESTION
ANSWER
Encapsulation is the mechanism that binds together code and data it manipulates and keeps both safe from outside
interference and misuse. Inheritance is the process by which one object acquires the properties of another object.
Polymorphism is the feature that allows one interface to be used for general class actions.
20
hirist
.com
QUESTION 20
QUESTION
21
hirist
.com
QUESTION 21
QUESTION
ANSWER
When an object is no longer referred to by any variable, java automatically reclaims memory used by that object.
This is known as garbage collection. System. gc() method may be used to call it explicitly.
22
hirist
.com
QUESTION 22
QUESTION
ANSWER
Inheritance is the process of inheriting all the features from a class. The advantages of inheritance are reusability of
code and accessibility of variables and methods of the super class by subclasses.
23
hirist
.com
QUESTION 23
QUESTION
ANSWER
A super class is a class that is inherited whereas sub class is a class that does the inheriting.
24
hirist
.com
QUESTION 24
QUESTION
ANSWER
a)
Integer is a class defined in the java. lang package, whereas int is a primitive data type defined in the Java
language itself. Java does not automatically convert from one to the other.
b)
b) Integer can be used as an argument for a method that requires an object, whereas int can be used for
calculations.
25
hirist
.com
QUESTION 25
QUESTION
ANSWER
The class whose instances are to be serialized should implement an interface Serializable. Then you pass the
instance to the ObjectOutputStream which is connected to a fileoutputstream. This will save the object to a file.
26
hirist
.com
QUESTION 26
QUESTION
ANSWER
a)
String objects are constants and immutable whereas StringBuffer objects are not.
b)
b) String class supports constant strings whereas StringBuffer class supports growable and modifiable strings.
27
hirist
.com
QUESTION 27
QUESTION
ANSWER
Array is a set of related data type and static whereas vector is a growable array of objects and dynamic.
28
hirist
.com
QUESTION 28
QUESTION
ANSWER
source : A source is an object that generates an event. This occurs when the internal state of that object changes in
some way.
listener : A listener is an object that is notified when an event occurs. It has two major requirements. First, it must
have been registered with one or more sources to receive notifications about specific types of events. Second, it
must implement methods to receive and process these notifications.
29
hirist
.com
QUESTION 29
QUESTION
ANSWER
Thread is an independent path of execution. It's way to take advantage of multiple CPU available in a machine. By
employing multiple threads you can speed up CPU bound task. For example, if one thread takes 100 millisecond
to do a job, you can use 10 thread to reduce that task into 10 millisecond. Java provides excellent support for
multi-threading at language level, and its also one of strong selling point.
30
hirist
.com
QUESTION 30
QUESTION
ANSWER
FutureTask represents a cancellable asynchronous computation in concurrent Java application. This class provides
a base implementation of Future, with methods to start and cancel a computation, query to see if the computation
is complete, and retrieve the result of the computation. The result can only be retrieved when the computation has
completed; the get methods will block if the computation has not yet completed. A FutureTask object can be used
to wrap a Callable or Runnable object. Since FutureTask also implements Runnable, it can be submitted to an
Executor for execution.
31
hirist
.com
QUESTION 31
QUESTION
There are three threads T1, T2 and T3? How do you ensure sequence T1,
T2, T3 in Java?
ANSWER
Sequencing in multi-threading can be achieved by different means but you can simply use join() method of thread
class to start a thread when another one is finished its execution. To ensure three threads execute you need to
start the last one first e.g. T3 and then call join methods in reverse order e.g. T3 calls T2. join, and T2 calls
T1.join, this ways T1 will finish first and T3 will finish last.
32
hirist
.com
QUESTION 32
QUESTION
ANSWER
A blocking method is a method which blocks until task is done, for example accept() method of ServerSocket blocks
until a client is connected. here blocking means control will not return to caller until task is finished. On the other
hand there are asynchronous or non-blocking method which returns even before task is finished.
33
hirist
.com
QUESTION 33
QUESTION
ANSWER
This is an interesting question for Java programmer, at first, volatile and atomic variable look very similar, but they
are different. Volatile variable provides you happens-before guarantee that a write will happen before any
subsequent write, it doesn't guarantee atomicity. For example count++ operation will not become atomic just by
declaring count variable as volatile. On the other handAtomicInteger class provides atomic method to perform
such compound operation atomically e.g. getAndIncrement() is atomic replacement of increment operator. It can
be used to atomically increment current value by one. Similarly you have atomic version for other data type and
reference variable as well.
34
hirist
.com
QUESTION 34
QUESTION
ANSWER
The JDK is the Java Development Kit. I.e., the JDK is bundle of software that you can use to develop Java based
software.
The JRE is the Java Runtime Environment. I.e., the JRE is an implementation of the Java Virtual Machine which
actually executes Java programs.
Typically, each JDK contains one (or more) JREs along with the various development tools like the Java source
compilers, bundling and deployment tools, debuggers, development libraries, etc.
35
hirist
.com
QUESTION 35
QUESTION
ANSWER
An annotation, in the java programming language is a special form of syntactic metadata that can be added to Java
Source Code.
Classes, methods, variables parameters and packages may be annotated.
Unlike Java doc tags, Java annotation are reflective, in that they are embedded in class files generated by the
compiler and may be retained by the java VM to make retrievable at run-time. Annotation is basically to attach
metadata to method, class or package. Metadata is used by the compiler to perform some basic compile-time
checking.
36
hirist
.com
QUESTION 36
QUESTION
37
hirist
.com
QUESTION 37
QUESTION
Which way a developer should use for creating thread, i.e. Sub classing
Thread or implementing Runnable.
ANSWER
There are two ways of creating Thread in java (i.e. sub classing or implementing Runnable). It is very important to
understand the implication of using these two approaches.
There are two different points about using these two approaches.
By extending the thread class, the derived class itself is a thread object and it gains full control over the thread life cycle.
Implementing the Runnable interface does not give developers any control over the thread itself, as it simply defines the
unit of work that will be executed in a thread.
Another important point is that when extending the Thread class, the derived class cannot extend any other base classes
because Java only allows single inheritance. By implementing the Runnable interface, the class can still extend other
38
hirist
.com
QUESTION 38
QUESTION
ANSWER
Threads are allowed to hold the values of variables in local memory (e.g. in a machine register).
If a variable is marked as volatile, every time when the variable is used, it must be read from the main memory,
similarly every time the variable is written, the value must be stored in main memory.
39
hirist
.com
QUESTION 39
QUESTION
What is Downcasting ?
ANSWER
Downcasting means casting from a general to a more specific type.
40
hirist
.com
QUESTION 40
QUESTION
ANSWER
Method is just an ordinary member function which consists of its own return type (can be a void), name and always
invoked by a dot operator whereas a constructor is the member function of that class which is used to create
objects in it, the name of the class and constructor is always same, no return type and always invoked by a new
operator.
41
hirist
.com
QUESTION 41
QUESTION
42
hirist
.com
QUESTION 42
QUESTION
ANSWER
Under preemptive scheduling, is the highest priority task which is executed until it enters the waiting or dead states
or a higher priority task. Under time slicing, a task executes for a predefined slice of time and then reenters the
pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other
factors.
43
hirist
.com
QUESTION 43
QUESTION
ANSWER
Applets may communicate with other applets running in the same virtual machine but its not necessary that they
communicate. If the applets are of the same class, they can communicate via shared static variables. If the
applets are of different classes, then each will need a reference to the same class with static variables. In any
case the basic idea is to pass the information back and forth through a static variable.
44
hirist
.com
QUESTION 44
QUESTION
ANSWER
Dynamic binding is orthogonal to dynamic linking. Binding refers to the linking of a procedure call to the code to be
executed in response to the call. Dynamic binding It is associated with polymorphism and inheritance, it(also
known as late binding) means that the code associated with a given procedure call is not known until the time of
the call at run-time.
45
hirist
.com
QUESTION 45
QUESTION
ANSWER
List of observers are maintained by the objects that are subclasses the observable class. When an Observable
object is updated it invokes the update() method of each of its observers to notify the observers that it has
changed state. The Observer interface is implemented by objects that observe Observable objects.
46
hirist
.com
QUESTION 46
QUESTION
ANSWER
An Inner class is a class which is nested within another class. An Inner class has access rights for the class which is
nesting it and it can access all variables and methods defined in the outer class.
A sub-class is a class which inherits from another class called super class. Sub-class can access all public and
protected methods and fields of its super class
47
hirist
.com
QUESTION 47
QUESTION
ANSWER
Encapsulation is a concept in Object Oriented Programming for combining properties and methods in a single unit.
Encapsulation helps programmers to follow a modular approach for software development as each object has its
own set of methods and variables and serves its functions independent of other objects. Encapsulation also
serves data hiding purpose.
48
hirist
.com
QUESTION 48
QUESTION
ANSWER
A singleton class in java can have only one instance and hence all its methods and variables belong to just one
instance. Singleton class concept is useful for the situations when there is a need to limit the number of objects for
a class.
The best example of singleton usage scenario is when there is a limit of having only one connection to a database
due to some driver limitations or because of any licensing issues.
49
hirist
.com
QUESTION 49
QUESTION
ANSWER
Looping is used in programming to execute a statement or a block of statement repeatedly. There are three types of loops in
Java:
1) For Loops
For loops are used in java to execute statements repeatedly for a given number of times. For loops are used when number
of times to execute the statements is known to programmer.
2) While Loops
While loop is used when certain statements need to be executed repeatedly until a condition is fulfilled. In while loops,
condition is checked first before execution of statements.
3) Do While Loops
Do While Loop is same as While loop with only difference that condition is checked after execution of block of statements.
Hence in case of do while loop, statements are executed at least once.
50
hirist
.com
QUESTION 50
QUESTION
ANSWER
break and continue are two important keywords used in Loops. When a break keyword is used in a loop, loop is
broken instantly while when continue keyword is used, current iteration is broken and loop continues with next
iteration
51
hirist
.com
QUESTION 51
QUESTION
ANSWER
Ternary operator, also called conditional operator is used to decide which value to assign to a variable based on a
Boolean value evaluation. Its denoted as?
In the below example, if rank is 1, status is assigned a value of Done else Pending.
1 public class conditionTest {
2 public static void main(string args[]) {
3 String status;
4 int rank;
5 status= (rank == 1) ? "Done": "Pending";
6}
7}
52
hirist
.com
QUESTION 52
QUESTION
ANSWER
In java, operators can be classified in following six types:
Arithmetic Operators
Logical Operators
Relational Operators
Assignment Operators
Bitwise operators
53
hirist
.com
QUESTION 53
QUESTION
Whats the base class in Java from which all classes are derived?
ANSWER
java.lang.object
54
hirist
.com
QUESTION 54
QUESTION
10
11 const_example c1=new const_example();
12
13 const_example c2=new const_example();
14
15 }
16
17 }
55
hirist
.com
QUESTION 55
QUESTION
ANSWER
We cannot override static methods. Static methods belong to a class and not to individual objects and are resolved
at the time of compilation (not at runtime).Even if we try to override static method,we will not get an complitaion
error,nor the impact of overriding when running the code.
56
hirist
.com
QUESTION 56
QUESTION
ANSWER
String is not a primitive data type in java. When a string is created in java, its actually an object of Java.Lang.String
class that gets created. After creation of this string object, all built-in methods of String class can be used on the
string object.
57
hirist
.com
QUESTION 57
QUESTION
What is multi-threading?
ANSWER
Multi threading is a programming concept to run multiple tasks in a concurrent manner within a single program.
Threads share same process stack and running in parallel. It helps in performance improvement of any program.
58
hirist
.com
QUESTION 58
QUESTION
ANSWER
Even if no explicit constructor is defined in a java class, objects get created successfully as a default constructor is
implicitly used for object creation. This constructor has no parameters.
59
hirist
.com
QUESTION 59
QUESTION
ANSWER
There are no pointers in Java. So we cant use concept of pointers in Java.
60
hirist
.com
QUESTION 60
QUESTION
ANSWER
Stack and Queue both are used as placeholder for a collection of data. The primary difference between a stack and
a queue is that stack is based on Last in First out (LIFO) principle while a queue is based on FIFO (First In First
Out) principle.
61
hirist
.com
QUESTION 61
QUESTION
What are the two environment variables that must be set in order to run
any Java programs?
ANSWER
Java programs can be executed in a machine only once following two environment variables have been properly
set:
1. PATH variable
2. CLASSPATH variable
62
hirist
.com
QUESTION 62
QUESTION
ANSWER
Checked exception are those which the Java compiler forces you to catch.Example:IOException are checked
exceptions.
63
hirist
.com
QUESTION 63
QUESTION
ANSWER
Runtime exceptions are those exceptions that are thrown at runtime because of either wrong input data or because
of wrong business logic etc. These are not checked by the compiler at compile time.
64
hirist
.com
QUESTION 64
QUESTION
ANSWER
Java provides specialized classes corresponding to each of the primitive data types. These are called wrapper
classes.They are example: Integer, Character, Double etc.
65
hirist
.com
QUESTION 65
QUESTION
ANSWER
Abstract class must be extended/subclassed (to be useful). It serves as a template. A class that is abstract may not
be instantiated (ie. you may not call its constructor), abstract class may contain static data.Any class with an
abstract method is automatically abstract itself, and must be declared as such. A class may be declared abstract
even if it has no abstract methods. This prevents it from being instantiated.
66
hirist
.com
QUESTION 66
QUESTION
ANSWER
The local variables are not initialized to any default value, neither primitives nor object references. If you try to use
these variables without initializing them explicitly, the java compiler will not compile the code. It will complain abt
the local varaible not being initilized.
67
hirist
.com
QUESTION 67
QUESTION
ANSWER
A Choice is displayed in a compact form that must be pulled down, in order for a user to be able to see the list of all
available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that
several List items are visible. A List supports the selection of one or more List items.
68
hirist
.com
QUESTION 68
QUESTION
What is clipping?
ANSWER
Clipping is defined as the process of confining paint operations to a limited area or shape.
69
hirist
.com
QUESTION 69
QUESTION
ANSWER
No, Java does not support multiple inheritance. Each class is able to extend only on one class, but is able to
implement more than one interfaces.
70
hirist
.com
QUESTION 70
QUESTION
Whats a deadlock ?
ANSWER
A condition that occurs when two processes are waiting for each other to complete, before proceeding. The result is
that both processes wait endlessly.
71
hirist
.com
QUESTION 71
QUESTION
ANSWER
Path and Classpath are operating system level environment variales. Path is used define where the system can find
the executables(.exe) files and classpath is used to specify the location .class files.
72
hirist
.com
QUESTION 72
QUESTION
ANSWER
Instance variables are those which are defined at the class level. Instance variables need not be initialized before
using them as they are automatically initialized to their default values.
73
hirist
.com
QUESTION 73
QUESTION
ANSWER
The variable should be declared as static and final. So only one copy of the variable exists for all instances of the
class and the value cant be changed also. static final int PI = 2.14; is an example for constant.
74
hirist
.com
QUESTION 74
QUESTION
ANSWER
The protected access modifier cannot be applied to class and interfaces. Methods, fields can be declared protected,
however methods and fields in a interface cannot be declared protected.
75
hirist
.com
QUESTION 75
QUESTION
ANSWER
A protected method can be accessed by the classes within the same package or by the subclasses of the class in
any package.
76
hirist
.com
QUESTION 76
QUESTION
What are the restriction imposed on a static method or a static block of code ?
ANSWER
A static method should not refer to instance variables without creating an instance and cannot use this operator to
refer the instance.
77
hirist
.com
QUESTION 77
QUESTION
ANSWER
Static varaibles are class level variables and they cant be declared inside a method. If declared, the class will not
compile.
78
hirist
.com
QUESTION 78
QUESTION
ANSWER
No not possible. Doing so will result in compilation error. public and abstract are the only applicable modifiers for
method declaration in an interface.
79
hirist
.com
QUESTION 79
QUESTION
Why is an Interface be able to extend more than one Interface but a Class cant extend
more than one Class ?
ANSWER
Basically Java doesnt allow multiple inheritance, so a Class is restricted to extend only one Class. But an Interface
is a pure abstraction model and doesnt have inheritance hierarchy like classes(do remember that the base class
of all classes is Object). So an Interface is allowed to extend more than one Interface.
80
hirist
.com
QUESTION 80
QUESTION
ANSWER
Java provides specialized classes corresponding to each of the primitive data types. These are called wrapper
classes. They are e.g. Integer, Character, Double etc.
81
hirist
.com
QUESTION 81
QUESTION
Under what circumstances might you use the yield method of the Thread class
ANSWER
-To call from the currently running thread to allow another thread of the same or higher priority to run
-To call on a waiting thread to allow it to run
-To allow a thread of higher priority to run
-To call from the currently running thread with a parameter designating which thread should be allowed to run
82
hirist
.com
QUESTION 82
QUESTION
If I want an object of my class to be thrown as an exception object, what should I
do?
ANSWER
The class should extend from Exception class. Or you can extend your class from some more precise exception
type also
83
hirist
.com
QUESTION 83
QUESTION
ANSWER
Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it
invokes the update() method of each of its observers to notify the observers that it has changed state. The
Observer interface is implemented by objects that observe Observable objects.
84
hirist
.com
QUESTION 84
QUESTION
If a class is declared without any access modifiers, where may the class be
accessed?
ANSWER
A class that is declared without any access modifiers is said to have package access. This means that the class can
only be accessed by other classes and interfaces that are defined within the same package.
85
hirist
.com
QUESTION 85
QUESTION
ANSWER
The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown
or caught.
86
hirist
.com
QUESTION 86
QUESTION
ANSWER
Yes, a double value can be cast to a byte.
87
hirist
.com
QUESTION 87
QUESTION
ANSWER
It must provide all of the methods in the interface and identify the interface in its implements clause.
88
hirist
.com
QUESTION 88
QUESTION
ANSWER
Cookies are a mechanism that a servlet uses to have a client hold a small amount of state-information associated
with the user. a) Create a cookie with the Cookie constructor: public Cookie(String name, String value)
b) A servlet can send a cookie to the client by passing a Cookie object to the addCookie() method of
HttpServletResponse: public void HttpServletResponse. addCookie(Cookie cookie)
c) A servlet retrieves cookies by calling the getCookies() method of HttpServletRequest: public Cookie[ ]
HttpServletRequest. getCookie().
89
hirist
.com
QUESTION 89
QUESTION
ANSWER
Servlet chaining is a technique in which two or more servlets can cooperate in servicing a single request. In servlet
chaining, one servlets output is piped to the next servlets input. This process continues until the last servlet is
reached. Its output is then sent back to the client.
90
hirist
.com
QUESTION 90
QUESTION
ANSWER
TCP/IP is a two-way communication between the client and the server and it is a reliable and there is a confirmation
regarding reaching the message to the destination. It is like a phone call. UDP is a one-way communication only
between the client and the server and it is not a reliable and there is no confirmation regarding reaching the
message to the destination. It is like a postal mail.
91
hirist
.com
QUESTION 91
QUESTION
ANSWER
The only statements for which it makes sense to use a label are those statements that can enclose
a break orcontinue statement.
92
hirist
.com
QUESTION 92
QUESTION
ANSWER
The elements of a CardLayout are stacked, one on top of the other, like a deck of cards
93
hirist
.com
QUESTION 93
QUESTION
What is the difference between a while statement and a do while statement?
ANSWER
A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do
while statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do
whilestatement will always execute the body of a loop at least once.
94
hirist
.com
QUESTION 94
QUESTION
ANSWER
The compiler supplies a default constructor for a class if no other constructors are provided.
95
hirist
.com
QUESTION 95
QUESTION
ANSWER
It is very difficult to remember a set of numbers(IP address) to connect to the Internet. The Domain Naming
Service(DNS) is used to overcome this problem. It maps one particular IP address to a string of characters. For
example, www. mascom. com implies com is the domain name reserved for US commercial sites, moscom is the
name of the company and www is the name of the specific computer, which is mascoms server.
96
hirist
.com
QUESTION 96
QUESTION
ANSWER
Jar file allows to efficiently deploying a set of classes and their associated resources. The elements in a jar file are
compressed, which makes downloading a Jar file much faster than separately downloading several
uncompressed files. The package java. util. zip contains classes that read and write jar files.
97
hirist
.com
QUESTION 97
QUESTION
ANSWER
A JSP directive affects the overall structure of the servlet class. It usually has the following form:<%@ directive
attribute=value %> However, you can also combine multiple attribute settings for a single directive, as
follows:<%@ directive attribute1=value1 attribute 2=value2 . . . attributeN =valueN %> There are two main
types of directive: page, which lets to do things like import classes, customize the servlet superclass, and the like;
and include, which lets to insert a file into the servlet class at the time the JSP file is translated into a servlet
98
hirist
.com
QUESTION 98
QUESTION
ANSWER
response. setHeader(Set-Cookie, cookie string); To give the response-object to a bean, write a method
setResponse (HttpServletResponse response) - to the bean, and in jsp-file:<% bean. setResponse (response);
%>
99
hirist
.com
QUESTION 99
QUESTION
ANSWER
Numeric promotion is the conversion of a smaller numeric type to a larger numeric type, so that integer and floatingpoint operations may take place. In numerical promotion, byte, char, and short values are converted to int values.
The int values are also converted to long values, if necessary. The long and float values are converted to double
values, as required.
100
hirist
.com
QUESTION 100
QUESTION
ANSWER
JSP pages are focused around HTML (or XML) with Java codes and JSP tags inside them. When a web server that
has JSP support is asked for a JSP page, it checks to see if it has already compiled the page into a servlet. Thus,
JSP pages become servlets and are transformed into pure Java and then compiled, loaded into the server and
executed.
101
hirist
.com
List of Resources
http://top100interviewquestions.com/java-basics-part1/
http://www.javacodegeeks.com/2014/04/java-interview-questions-and-answers.html#2
http://beginnersbook.com/2013/05/java-interview-questions/#h3
http://www.slideshare.net/p2cinfotech/java-frequently-asked-interview-questions-andanswers
http://www.javatpoint.com/corejava-interview-questions-1
http://www.techinterviews.com/master-list-of-java-interview-questions
http://javarevisited.blogspot.com/2014/07/top-50-java-multithreading-interviewquestions-answers.html
https://www.udemy.com/blog/java-interview-questions/
http://careerride.com/Interview-Questions-Core-Java.aspx
http://career.guru99.com/top-100-core-java-interview-questions/1/
http://careerbaba.in/2014/01/top-50-core-java-interview-questions-and-answers/
102
www.hirist.com
TOP 100
JAVA