The 'Hello World' program, of Tutorial 1, is described.
The package refers to this folder structure.
// *** 1. Start *** package com.javaAndroid.ex1; // *** 1. End ***
Class can be public or default (package-level). Public would be important for external libraries, such as standard Java classes such as java.lang.Math, which have to be used in almost any real application.
// *** 2. Start public class Ex1 { // *** 2. End
The main() function is the entry-point of a java program.
// *** 3. Start public static void main (String[] args) { // *** 3. End
String is a utility class based on the char primitive.
// *** 4. Start String hello = "Hello World!"; // *** 4. End
println() method is part of java.lang.System class.
// *** 5. Start System.out.println(hello); } } // *** 5. End
// *** 1. Start *** package com.javaAndroid.ex1; // *** 1. End *** // *** 2. Start public class Ex1 { // *** 2. End // *** 3. Start public static void main (String[] args) { // *** 3. End // *** 4. Start String hello = "Hello World!"; // *** 4. End // *** 5. Start System.out.println(hello); } } // *** 5. End
No comments:
Post a Comment