Q1.:-Why is Java considered ideal for network communication?
A:- Java is considered ideal for network communication because it is a platform independent language.Java enables an application to be executed on any network.The built-in classes of Java support TCP/IP and UDP protocols used for network communication.Java supports the Client-Server model for network communication.
Q2.:-What is Java Technology?
A: The Java technology is
- A Programming language
- A development environment
- An application environment
- A deployment environment
A:- The Java Platform, Standard Edition (Java SE platform) and Java for Business are currently shipping from Sun Microsystems, Inc. in the form of the Java Development Kit (JDK), and Java Runtime Environment (JRE).
Each release of the Java 2 SDK, Standard Edition contains:
- Java Compiler
- Java Virtual Machine*
- Java Class Libraries
- Java AppletViewer
- Java Debugger and other tools
- Documentation (in a separate download bundle)
To run Java 1.0 applets, use Netscape Navigator 3.x or other browsers that support Java applets. To run Java 1.1.x applets, use HotJava 1.x or Netscape Navigator 4.x or other browsers that support the newest version of the Java API.
Q4.:- What platform is the java technology software available on?
A:- Sun provides ports of the Java 2 Platform for Windows 95, Windows 98, Windows NT, Windows 2000,windows xp, windows vista, windows 7, Solaris-SPARC, Solaris-Intel, and Linux.
Q5.:-How do I download Java technology and/or Java 2 SDK software? How do I install it?
A:-You can get our releases either with a World Wide Web (WWW) browser or by anonymous ftp. For details, including installation instructions, visit:
Choose the software you want, and go from there.The Java 2 Platform web site (http://java.sun.com/j2se/)
Q6.:- What's the difference between an interface and an abstract class?
A:- 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 implement multiple interfaces in your class.
Q7.:- How can you force garbage collection?
A:- You can't force GC, but could request it by calling System.gc(). JVM does not guarantee that GC will be started immediately.
Q8.:- How do you know if an explicit object casting is needed?
A: -If you assign a superclass object to a variable of a subclass's data type, you need to do explicit casting. For example:
Object a; Customer b; b = (Customer) a;
When you assign a subclass to a variable having a supeclass type, the casting is performed automatically.
Q9: -What's the difference between the methods sleep() and wait()?
A:- The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.
Q10.: -What's the difference between constructors and other methods?
A:- Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times.