<< < 22 23 24 25 26 27   Sort: Rank

Serializable Interface
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.
2007-03-03, 5433👍, 0💬

CLASSPATH Environment Variable
If a class is located in a package, what do you need to change in the OS environment to be able to use it? You need to add the directory or the jar file that contains the package to the CLASSPATH environment variable. Let's say a class Employee belongs to a package com.xyz.hr; and is located in the ...
2007-03-03, 5227👍, 0💬

Defining an Interface
How to define an Interface? Java Interface defines methods but does not implement them. Interface can include constants. A class that implements an interface is required to implement all the methods defined in the interface. Here is an example of interface definition: public interface MyInterface { ...
2007-03-03, 5424👍, 0💬

Defining Abstract Classes
How to define an Abstract class? Defining an abstract class is done using the keyword "abstract". Here is an example of abstract class: abstract class MyAbstract { protected String myString; public String getMyString() { return myString; } public abstract string getMyStringInYourWay(); }
2007-03-03, 5292👍, 0💬

Iterator Interface
Is Iterator a Class or Interface? What is its use? Iterator is an interface which is used to step through the elements of a Collection.
2007-03-03, 5306👍, 0💬

What is Collection API
What is Collection API? The Collection API is a set of classes and interfaces that support operation on collections of objects. These classes and interfaces are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables. Example of classes: HashSet, HashMap, ArrayList, L...
2007-03-03, 5622👍, 0💬

What Is Synchronization
What do you understand by Synchronization? Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modif...
2007-03-03, 5264👍, 0💬

Swing BorderLayout and Contrainer Classes
Name the containers which uses Border Layout as their default layout? Swing container classes which uses BorderLayout as their default are: Window, Frame and Dialog classes.
2007-03-03, 5363👍, 0💬

Differences between Interfaces and Abstract Classes
What's the difference between an interface and an abstract class? An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implemen...
2007-03-03, 5500👍, 0💬

System.setOut() - Setting Standard Console Output to
How could Java classes direct program messages to the system console, but error messages, say to a file? The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both connected to the system console. But...
2007-03-03, 8121👍, 0💬

System.loadLibrary() - Loading DLL for JNI Interface
An application needs to load a library before it starts to run, how to code? One option is to use a static block to load a library before anything is called. For example, class Test { static { System.loadLibrary("myApp.dll" );} .... } When you call new Test(), the static block will be called first b...
2007-03-03, 8031👍, 0💬

Troubleshooting NullPointerException
What is NullPointerException and how to handle it? When an object is not initialized, the default value is null. When the following things happen, the NullPointerException is thrown: Calling the instance method of a null object. Accessing or modifying the field of a null object. Taking the length of...
2007-03-03, 8048👍, 0💬

Runable Interface and Thread
What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class? Strategically speaking, threads created by implementing Runnable interface are more advisable. If you create a thread by extending a thread class, you cannot extend any other class. If you c...
2007-03-03, 6497👍, 0💬

Clone of Map Objects
Jack developed a program by using a Map container to hold key/value pairs. He wanted to make a change to the map. He decided to make a clone of the map in order to save the original data on side. What do you think of it? If Jack made a clone of the map, any changes to the clone or the original map w...
2007-03-03, 6944👍, 0💬

Virtual Functions in Java
Can you have virtual functions in Java? Yes, all functions in Java are virtual by default. This is actually a pseudo trick question because the word "virtual" is not part of the naming convention in Java (as it is in C++, C-sharp and VB.NET), so this would be a foreign concept for someone who has on...
2007-03-03, 6314👍, 0💬

Well-Written Object Oriented Programs
What does a well-written Object Oriented program look like? A well-written object oriented program exhibits recurring structures that promote abstraction, flexibility, modularity and elegance.
2007-03-03, 6832👍, 0💬

What is Java
What is Java? Java is an object-oriented programming language developed initially by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to replace C++, although the feature set better resembles that ...
2007-03-03, 5816👍, 0💬

<< < 22 23 24 25 26 27   Sort: Rank