Creating & Running a Java Program

  • BlueJ is an IDE for Java. It provides an editor and access to the standard Java compiler and runtime system. The two methods of creating and running Java programs are: general method and using BlueJ.
  • To create a Java program using general method, start a text editor such as Notepad and type the Java source code. Click on Start menu. Select Run and type CMD.exe. Now, change directory to bin folder using CD command. Compile the program using Java compiler javac.If compilation is successful, it will create a dot class file for every class given in the source code.
  • To run a program on command prompt, type java followed by the name of the initial class.
  • BlueJ is specifically designed to learn and teach object-oriented approach. After running BlueJ, the main window will open.
  • To create a Java program using BlueJ, select Project menu and click on New Project. Enter project name and click on Create.Create a new class by clicking on New Class. Type file name in the dialog box and then click on Ok. Class icon will appear in the window. Double click on it to open the class editor.Delete the default code and write the code in this editor. Compile the program usingCompile button and click on it. Now, right click on the compiled icon of class and select the main method.
  • The main method executes main method of class. Click on OK button. The output of the code appears.

To Access the full content, Please Purchase

  • Q1

    Comments written in the beginning of a program are called

    Marks:1
    Answer:

    prologues.

    Explanation:
    It is few lines of code or statements in the beginning of a program that summarises the purpose of the program and increases program understanding ability.
    View Answer
  • Q2

    In Java, statements are terminated with a

    Marks:1
    Answer:

    semicolon.

    Explanation:
    Semicolon (;) is used to terminate statements in Java. The simplest statement is a null statement or an empty statement.
    View Answer
  • Q3

    The operator that returns a reference to a new instance of a class is

    Marks:1
    Answer:

    new.

    Explanation:
    The new operator returns a reference to a new instance of a class. All objects are created with the new operator.  
    View Answer
  • Q4

    An application program consisting of different development tools needed for developing an application, is called

    Marks:1
    Answer:

    Integrated Development Environment.

    Explanation:

    It is a software application that provides facilities to computer programmers for software development.

    View Answer
  • Q5

    A special kind of Java program that a browser enabled with Java technology can download from the internet and run, is

    Marks:1
    Answer:

    an applet.

    Explanation:
    An applet is typically embedded inside a web-page and runs in the context of the browser.
    View Answer