Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Java Lab CS110A – Lab Section 004 Instructor: Duo Wei.

Similar presentations


Presentation on theme: "Introduction to Java Lab CS110A – Lab Section 004 Instructor: Duo Wei."— Presentation transcript:

1 Introduction to Java Lab CS110A – Lab Section 004 Instructor: Duo Wei

2 Outline General Information for Java Lab Introduction to Eclipse First program – “ Hello World! ”

3 General Information Instructor: Duo Wei Office: GITC 4402 Office hours: Friday 5-6pm Email: duowei.mywork@gmail.com For more information, please visit my website: http://web.njit.edu/~dw59

4 What is Eclipse? An Integrated Development Environment Useful tool for Java program development Provides many features to ease Java programming (and others, e.g. C/C++) Editor Debugger Source Control …

5 Getting Eclipse At the CS labs … It ’ s already installed At home … Download the latest version at: http://www.eclipse.org/

6 Installing and Running Eclipse Installation is very simple Just unpack the downloaded package Running Eclipse Then click eclipse.exe (under Windows) Run eclipse (under Linux) Eclipse will start running if all the prerequisites are met Demo: Run Eclipse

7 Setting up your Workspace Workspace is where your projects and programs are stored. Usually some directory in the file system The workspace is set when Eclipse starts My suggestion: create a file in the local directory. Eg. My Document  create your file (Duo)

8 Creating Java Projects Demo: Creating a project for assignment1 in the workspace

9 Creating Java Packages A Package in Java is a group of classes which are often closely or logically related in some way Package corresponds to the directory hierarchy in the file system. course.cs110.assignment1 Organizing source files into different packages is a good programming style. Since this is the first class you do not need to create package. Create class directly, see next slide …

10 Adding Java Classes Class is the basic compilation unit in Java. Demo: Creating the Employee class of assignment1

11 Running the code Currently, no implementation is provided in the given files. You are expected to fill the implementation details. We need a class which has a main() method as the entrance for execution Run (Menu)  Run as  find your java file click

12 Review what we learned … Setting up your Workspace Creating Java Projects Creating Java Packages (not necessary) Adding Java Classes Running the code

13 First Java program-HelloWorld public class HelloWorld{ public static void main(String args[]){ System.out.println( “ Hello World! ” ); } Now, run the program, and see what is the output?

14 Questions?


Download ppt "Introduction to Java Lab CS110A – Lab Section 004 Instructor: Duo Wei."

Similar presentations


Ads by Google