-
What is the difference between exception and error
Answered by Scott on 2005-05-12 09:50:36: An Exception can be caught and recovered: ArrayIndexOutOfBoundsException means you tried to access a position of an Array that does not exist - no big deal. An Error is unrecoverable: OutOfMemoryError means that the JVM has no more memory to contin
-
-
Java Program Execution
How does Java program compile and execute to give output?
-
What is the difference between static and non-static variables
A static variable is associated with the class as a whole rather than with specific instancesof a class. Non-static variables take on unique values with each object instance.
-
What is the purpose of garbage collection
The purpose of garbage collection is to identify and discard objects that are no longerneeded by a program so that their resources may be reclaimed and reused.
-
} ">
The following code defines the ThreadSample class. public class ThreadSample implements Runnable { public static void main(String args[]) { System.out.println("This is the ThreadSample object"); }
/ The following code defines the ThreadSample class. public class ThreadSample implements Runnable { public static void main(String args[]) { System.out.println("This is the ThreadSample object"); } public void run() { while (true) { try { Thread.sleep(100); System.out.println("Thread ran."); } catch (Exception e) {} } Referring to the sample...
-
What is the legal range of a byte integral type?
A) 0 - 65, 535B) (-128) - 127C) (-32,768) - 32,767D) (-256) - 255
-
Why Bind variables will be deleted when you restart the server. Can you change this scenario.
I am trying to develop a small application. In this i have provided registration and login form. Username and password are stored in the JNDI server. This application is working fine. but when i am restarting the server, all the bind variables are deleting. why? i want to store them permanently. can you provide me the solution.
Thanks in advance. -
What is the difference between the >> and >>> operators
The >> operator carries the sign bit when shifting right. The >>> zero-fills bits that havebeen shifted out.
-
-
In order for a source code file, containing the public class Test, to successfully compile, which of the following must be true?
A) It must have a package statementB) It must be named Test.javaC) It must import java.langD) It must declare a public class named Test
-
-
Python programming
How do i write a module to keep count of the amount of guesses it takes to guess the number correctly?
-
JUnit
What is JUnit and how it is used?
-
Java code to set column width in CSV file
Can someone help on how to set the column width in CSV file using javacode.
I have used FileWriter class to upload data into the csv file. Results are getting populated properly but csv file showing results with default column width. Is there a way we can set the width of the column dynamically based on result length or set fixed length?
-
-
-
Which characters may be used as the second character of an identifier,but not as the first character of an identifier
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.
-
What is the preferred size of a component
The preferred size of a component is the minimum component size that will allow thecomponent to display normally.
-
Predict the output of the given code:
javapublic class Test {
private static String msg = "HCL ";
static{
Thread t = new Thread(new Runnable(){
public void run(){
msg = "Technologies ";
}
});
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...
Java Interview Questions
Ans