Simple Java Program

James Gosling developed Java at Sun Microsystem, as C and C++ was not able to meet the requirements. C++ has some drawbacks that lead to the development of Java. Java provides several exciting features that make programming convenient and easier. Use class keyword to declare the class My First Program. Enclose the body of the class within curly braces. The class contains the main () method. The main() method is where an application begins executing. In java, all data and functions are declared in class. To declare a class, class keyword is used.

Internet applets are small programs that are embedded in web pages and run on the viewers’ machine in secured manner. Standalone applications is a software application that does not require low level operating system and hardware access. Execution of Java Stand Alone Applications begins from main method. If there are several classes in a program, only one class will contain main method, which is called initial class. Main method is declared as public static. There are two methods of creating and running Java program. General method and Using I-D-E like Blue-J.

To Access the full content, Please Purchase

  • Q1

    On successful compilation of a Java source code file, a new file is created automatically by the compiler in the bin directory. What is the extension of this file?

    Marks:1
    Answer:

    Extension of the file is - .class

    View Answer
  • Q2

    Name the application on which Java programs are compiled and executed in general method of writing and executing Java program?

    Marks:1
    Answer:

    Java source programs are compiled and executed on command prompt (MS-Dos).

    View Answer
  • Q3

    Which editors can be used to write Java source code in general method of writing and executing Java program?

    Marks:1
    Answer:

    We may use any text editor like Notepad, Word-pad etc. to write Java source code program.

    View Answer
  • Q4

    Name the types of Java programs?

    Marks:1
    Answer:

    Java programs are of two types:
    1. Internet Applets
    2. Stand Alone Applications

    View Answer
  • Q5

    Which key word is used to declare a class in Java?

    Marks:1
    Answer:

    Keyword class is used to declare a class in Java.

    View Answer