Download presentation
Presentation is loading. Please wait.
1
USING ECLIPSE TO CREATE HELLO WORLD
2
Steps Create a Java project Define the build settings
Add a class to the project Complete the code for the main procedure to write to the standard output device
3
Eclipse Default Workspace
When you start Eclipse, you must first select a workspace The folder where your programs get stored I suggest that you use a USB stick for all programs so put the default workspace there That way you can access programs from any computer The default workspace really nothing more than a folder where applications are stored
4
Eclipse Workspace (Example)
Select or create a default workspace
5
Creating a Java Project
6
Defining the Build Settings
7
Add a Class to the Project
Click File, New, Class to begin creating the first class
8
Create the code
9
Dissecting Hello World (1)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } public is an access modifier
10
Dissecting Hello World (2)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } Everything is a class
11
Dissecting Hello World (3)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } The case sensitive class name is FirstSample
12
Dissecting Hello World (4)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } Braces enclose all blocks including a class block
13
Dissecting Hello World (5)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } Braces enclose all blocks including a procedure block
14
Dissecting Hello World (6)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } The entry point is public
15
Dissecting Hello World (7)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } static means the method is shared. It’s true for all program entry points!
16
Dissecting Hello World (8)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } void means the method does not return a value. It’s the same as a Sub procedure in VB
17
Dissecting Hello World (9)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } main is always the name of the entry point
18
Dissecting Hello World (10)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } The method argument list (type varname)
19
Dissecting Hello World (11)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } Brackets mark array arguments (like () in VB). The data type of the array is String
20
Dissecting Hello World (12)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } We don’t use it but it’s the argument variable
21
Dissecting Hello World (13)
public class FirstSample { public static void main(String[] args) System.out.println("Z. Beeblebrox"); } And finally the method call to print a message to the Console View
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.