Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPSC150 Fall 2008 Dr. L. Lambert. CPSC150 Overview Syllabus Use Textbook, ask questions, extra thorough, I will post sections covered All information.

Similar presentations


Presentation on theme: "CPSC150 Fall 2008 Dr. L. Lambert. CPSC150 Overview Syllabus Use Textbook, ask questions, extra thorough, I will post sections covered All information."— Presentation transcript:

1 CPSC150 Fall 2008 Dr. L. Lambert

2 CPSC150 Overview Syllabus Use Textbook, ask questions, extra thorough, I will post sections covered All information and assignments posted on CPSC150 web page: For anything you don’t see on the web page, send me email All grades posted on Blackboard

3 Success in this Class Collaborative Come prepared to work in class Take notes; pay attention; ask questions Never procrastinate Don’t assume you know/can program easily Come see me/Java expert early and often Ask questions Consult with (possibly non-expert) peers, but be careful. >50% of your grade is exams. Make sure you are doing your own work before you take the exam

4 Success in the Department Join ACM, IEEE, SWE Study with others. –Right now, find others and exchange: major, contact information, one thing about you Sign up for department info. 1.open browser, go to www.pcs.cnu.eduwww.pcs.cnu.edu 2.click on mailing lists, and students and careers 3.Subscribe using an email address that you read regularly

5 Using Java and Jedit We will use Jedit for program development JEdit is editor – lots of others (e.g., Eclipse) free and available for Mac, Windows, UNIX (download Java 1.5 first): http://java.sun.com/j2se/1.5.0/download.jsp (Download SDK, NOT JRE) http://www.java.com/en/download/index.jsp Download jedit for your home machines for development: http://www.jedit.org

6 Next Steps Running Java Code Reading Java Code Writing Java Code

7 PC, Linux, Mac, Unix Operating System and Computer Java Virtual Machine Java ByteCode Figure 1.5 from textbook

8 Java program (Source Code) Compiler Java Byte Code Program (Object Code) JVM runs program Output of program

9 Reading Source Code A Java program import package; // if any // comments and /* … */ and /** javadoc here */ public class Name { // entire program in here. For now, main only public static void main(String[ ] args) { // put code here }

10 Write, Compile and Test Listing Figure 1.1, page 15 // This application program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } // Green part is the same in every program // Black is the program

11 Three Steps to A Program 1.Type program (in JEdit) 2.Compile program (using javac) 3.Run program (using java)

12 1.Type program Open Jedit. Type program. Save. public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } Save as classname +.java –File name MUST be class name +.java (Welcome.java in this case)

13 2. Compile program 1.Go to Start 2.Choose Run … 3.Type cmd in box 4.Type javac Welcome.java – need ‘c’ and ‘.java’

14 Run program 1.If errors, fix them 2.If no errors, you will see a prompt 3.Run your program: java (no ‘c’) program (no.java) at prompt: java Welcome

15 Parts to a program Class name –must be same as file name main function –required for every Java program { }s around class and around main ‘;’ at the end of every statement in a function System.out.println for printing

16 Write a program that prints “My name is …” (fill in your name). Save it to your username.


Download ppt "CPSC150 Fall 2008 Dr. L. Lambert. CPSC150 Overview Syllabus Use Textbook, ask questions, extra thorough, I will post sections covered All information."

Similar presentations


Ads by Google