Explain Step Programming in Java
nick1234:
Plz help me
Answers
Answered by
1
1. Getting Started - Write your First Java ProgramYou should have already installed Java Development Kit (JDK). Otherwise, Read "How to Install JDK and Get Started with Java Programming".Let us begin by writing our first Java program that prints a message "Hello, world!" to the display console, as follows:Hello, world!Step 1: Write the Source Code: Enter the following source codes using a programming text editor (such as TextPad or NotePad++ for Windows; jEdit or gedit for Mac OS X; gedit for Ubuntu); or an Interactive Development Environment (IDE) (such as Eclipse or NetBeans).Do not enter the line numbers (on the left panel), which were added to aid in the explanation. Save the source file as "Hello.java". A Java source file should be saved with a file extension of ".java". The filename shall be the same as the classname - in this case "Hello".1
2
3
4
5
6
7
8/*
* First Java program, which says "Hello, world!"
*/
public class Hello { // Save as "Hello.java"
public static void main(String[] args) {
System.out.println("Hello, world!"); // print message
}
}Step 2: Compile the Source Code: Compile the source code "Hello.java" into portable bytecode "Hello.class" using JDK Compiler "javac". Start a CMD Shell (Windows) or Terminal (UNIX/Linux/Mac OS X) and issue this command:prompt> javac Hello.javaThere is no need to explicitly compile the source code under IDEs (such as Eclipse or NetBeans), as they perform incremental compilation implicitly.Step 3: Run the Program: Run the program using Java Runtime "java", by issuing this command:prompt> java Hello
Hello, world!
Similar questions
Chemistry,
8 months ago
Math,
1 year ago
English,
1 year ago
Biology,
1 year ago
Environmental Sciences,
1 year ago