45,000 Jobs - Get an Interview Call,  Post Your Resume Here
SURESHKUMAR.NET FORUMS
Registered Member Login:
Not a member? Register today!



Welcome to the SURESHKUMAR.NET FORUMS.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.




JAVA Q&A part1

        

Reply
 
LinkBack Thread Tools Display Modes
Old 18-02-06, 07:45 AM   #1 (permalink)
Member
 
Join Date: Feb 2006
Location:
Posts: 42
Thanks: 0
Thanked 8 Times in 5 Posts
Rep Power: 4 naga has disabled reputation
What is a platform?
A platform is the hardware or software environment in which a program runs. Most platforms can be described as a combination of the operating system and hardware, like Windows 2000/XP, Linux, Solaris, and MacOS.
--------------------------------------------------
*What is the main difference between Java platform and other platforms?
The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms.
The Java platform has two components:
*The Java Virtual Machine (Java VM)
*The Java Application Programming Interface (Java API)
--------------------------------------------------
*What is the Java Virtual Machine?
The Java Virtual Machine is a software that can be ported onto various hardware-based platforms.
--------------------------------------------------
*What is the Java API?
The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets.
--------------------------------------------------
*What is the package?
The package is a Java namespace or part of Java libraries. The Java API is grouped into libraries of related classes and interfaces; these libraries are known as packages.
--------------------------------------------------
*What is native code?
The native code is code that after you compile it, the compiled code runs on a specific hardware platform.
--------------------------------------------------
*Is Java code slower than native code?
Not really. As a platform-independent environment, the Java platform can be a bit slower than native code. However, smart compilers, well-tuned interpreters, and just-in-time bytecode compilers can bring
performance close to that of native code without threatening portability.
--------------------------------------------------
*What is the serialization?
The serialization is a kind of mechanism that makes a class or a bean persistence by having its properties or fields and state information saved and restored to and from storage.
--------------------------------------------------
*How to make a class or a bean serializable?
By implementing either the java.io.Serializable interface, or the java.io.Externalizable interface. As long as one class in a class's inheritance hierarchy implements Serializable or Externalizable, that class is serializable.
--------------------------------------------------
*How many methods in the Serializable interface?
There is no method in the Serializable interface. The Serializable interface acts as a marker, telling the object serialization tools that your class is serializable.
--------------------------------------------------
*How many methods in the Externalizable interface?
There are two methods in the Externalizable interface. You have to implement these two methods in order to make your class externalizable. These two methods are readExternal() and writeExternal().
--------------------------------------------------
*What is the difference between Serializalble and Externalizable interface?
When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject() two methods to control more complex object serailization
process. When you use Externalizable interface, you have a complete control over your class's serialization process.
--------------------------------------------------
*What is a transient variable?
A transient variable is a variable that may not be serialized. If you don't want some field not to be serialized, you can mark that field transient or static.
--------------------------------------------------
*Which containers use a border layout as their default layout?
The window, Frame and Dialog classes use a border layout as their default layout.
--------------------------------------------------
*How are Observer and Observable used?
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.
--------------------------------------------------
*What is synchronization and why is it important?
With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared
object while another thread is in the process of using or updating that object's value. This often causes dirty data and leads to significant errors.
--------------------------------------------------
*What are synchronized methods and synchronized statements?
Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it hasacquired the lock for the method's object or class. Synchronized
statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.
------------------------------------------- -------
*What are three ways in which a thread can enter the waiting state?
A thread can enter the waiting state by invoking its sleep() method, by blocking on I/O, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the
waiting state by invoking its (deprecated) suspend() method.
--------------------------------------------------
*Can a lock be acquired on a class?
Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object.
--------------------------------------------------
*What's new with the stop(), suspend() and resume() methods in JDK 1.2?
The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.
--------------------------------------------------
*What is the preferred size of a component?
The preferred size of a component is the minimum component size that will allow the component to display normally.
--------------------------------------------------
*What method is used to specify a container's layout?
The setLayout() method is used to specify a container's layout.
--------------------------------------------------
*Which containers use a FlowLayout as their default layout?
The Panel and Applet classes use the FlowLayout as their default layout.
--------------------------------------------------
*What state does a thread enter when it terminates its processing?
When a thread terminates its processing, it enters the dead state.
--------------------------------------------------
*What is the Collections API?
The Collections API is a set of classes and interfaces that support operations on collections of objects.
--------------------------------------------------
*What is the List interface?
The List interface provides support for ordered collections of objects.
--------------------------------------------------
*How does Java handle integer overflows and underflows?
It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.
--------------------------------------------------
*What is the Vector class?
The Vector class provides the capability to implement a growable array of objects
--------------------------------------------------
*What modifiers may be used with an inner class that is a member of an outer class?
A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.
--------------------------------------------------
*If a method is declared as protected, where may the method be accessed?
A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.
--------------------------------------------------
*What is an Iterator interface?
The Iterator interface is used to step through the elements of a Collection.
--------------------------------------------------
*How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16
uses 16-bit and larger bit patterns.
--------------------------------------------------
*What is the difference between yielding and sleeping?
When a task invokes its yield() method, it returns to the ready state.
When a task invokes its sleep() method, it returns to the waiting state.
--------------------------------------------------

naga is offline Offline   Reply With Quote
The Following 3 Users Say Thank You to naga For This Useful Post:
AjayKumar.Kataram (25-12-08), Ajay_KN (18-10-06), nandhini_7 (03-05-07)
Old 06-10-06, 06:25 PM   #2 (permalink)
Junior Member
 
Join Date: Oct 2006
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 4 vasantha_s_01 is on a distinguished road
Re: JAVA Q&A part1

hi ALL members
I want ask quesion on package,see the following simple program and tell me
how compile and run the program.
ex:
package p1;
public class A
{
int n=1;
public int pub=2;
private int pri=3;
protected int pro=4;
public A()
{
System.out.println("n="+n);
System.out.println("pub="+pub);
System.out.println("pri="+pri);
System.out.println("pro="+pro);
}
}

Now i am created the directory p1 and compile this about program
it will compile and give the .class file.
Now i create another class within the same package
say for ex

package p1;
public class B
{
public static void main(String arg[])
{
A ob=new A();
}
}

When i compile the above program in the same directory(p1)
it does not compile. Why it does not compiled.Tell me answer.
How compile and run this program
Thanking you
S.VASANTHA
vasantha_s_01 is offline Offline   Reply With Quote
Old 27-04-07, 11:53 AM   #3 (permalink)
Junior Member
 
Join Date: Apr 2007
Age: 25
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 3 rajeshkarka is on a distinguished road
Re: JAVA Q&A part1

Hi,

When you r compiling classes with packages you can use with -d option.

ForEx:You r compiling class A. you can compile like "javac -d . A.java". It will automatically creates a folder named with package and put these classes into that package.
rajeshkarka is offline Offline   Reply With Quote
Old 25-12-08, 11:48 PM   #4 (permalink)
Senior Member
 
Join Date: Aug 2006
Location: Hyderabad,India
Age: 30
Posts: 8,044
Thanks: 2,105
Thanked 425 Times in 303 Posts
Rep Power: 124 AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute
Re: JAVA Q&A part1

Thanks
AjayKumar.Kataram is offline Offline   Reply With Quote
Reply

Tags
java , part1 , qanda


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +6.5. The time now is 11:22 AM.

More Interview Questions Here...

Content Relevant URLs by vBSEO 3.3.0