Share on Google+Share on Google+

Java Questions & Java FAQ

Java Questions & Java FAQ

Java Questions & Java FAQ


In this Java Question series we have listed the Java Questions which are commonly asked. Our collection of frequently asked questions (FAQ) will provide you brief answers to many common questions about the Sun Programming Language. 

Here are the list of those Java Questions and FAQs.

  1. Question: It is said that the code in a finally clause will never fail to execute, Is there any example where it fails to execute?
    Answer: Here is the example code where the finally clause code will not execute.
      public class testFinally{
    	public static void main(String[] args){
    		System.out.println("Executing the program");
    		  try {
    			System.out.println("In the try block");
                            } finally {
    			System.out.println("In the finally.");

    Download the code

  2. Question: Why there are no global variables in Java?
    Answer: Global variables are globally accessible. Java does not support globally accessible variables due to following reasons: 
    * The global variables breaks the referential transparency
    * Global variables creates collisions in namespace.
  3. Question: What platforms is the Java-technology software available on?
    Answer: Sun provides ports of the Java 2 Platform for Windows 95, Windows 98, Windows NT, Windows 2000, Solaris-SPARC, Solaris-Intel, and Linux.
  4. Question: Where can I download latest version of Java?
    Answer: Latest version of JDK can be downloaded from Sun web site
  5. Question: Do I need to know C++ to learn Java?
    Answer: No, you don't need to know C or C++ to learn Java. Java is much simpler that C++.
  6. Question: What is the difference between Java and Java Script?
    Answer: In Java and Java Script only the "Java" word is common. Java is programming language from Sun. JavaScript is a programming language from Netscape, which runs in their browsers.
  7. Question: Differentiate between applet and application.
    Answer: Java applications runs as stand-alone application whereas applet runs in web browser. Application is a Java class that has a main() method. Applet class extends java.applet.Applet class.
  8. Question: How to convert String to Number in java program?
    Answer: The valueOf() function of Integer class is is used to convert string to Number. Here is the code example:
    String strId = "10";

    int id=Integer.valueOf(strId);

  9. Question: What is interface?
    In Java Interface defines the methods but does not implement them. Interface can include constants. A class that implements the interfaces is bound to implement all the methods defined in Interface.
    Example of Interface:
    public interface sampleInterface {
      public void functionOne();

      public long CONSTANT_ONE = 1000;

  10. Question: How you can force the garbage collection?
    Answer: Garbage collection automatic process and can't be forced.


Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Java Questions & Java FAQ  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
July 2, 2011

How to set container at the end of the page or just below the buttons
December 7, 2011

What the difference betw Abstract class and interface..?
Aoy Kumar Bhagat
January 17, 2012
java programming

I want to write java program and want to run that progam, i am begainer in java programming, please send me the details procedure and required softwares. Also mention download location and installation procedure of the given software. Please solve fast.