Blanca Polo ICS 111 - PowerPoint PPT Presentation

About This Presentation
Title:

Blanca Polo ICS 111

Description:

Blanca Polo - ICS 111. Introduction to Computer Science I. JAVA. Your First Program ... this comment runs to the terminating. symbol, even across line breaks ... – PowerPoint PPT presentation

Number of Views:60
Avg rating:3.0/5.0
Slides: 14
Provided by: blanc9
Learn more at: http://www2.hawaii.edu
Category:
Tags: ics | blanca | linebreaks | polo

less

Transcript and Presenter's Notes

Title: Blanca Polo ICS 111


1
JAVA
  • Your First Program

2
Program Skeleton
public class ProgramName public static void
main(String args) //instructions go
here
Comments
3
Comments
  • Documentation
  • They do not affect how a program works

// this comment runs to the end of the line
/ this comment runs to the terminating
symbol, even across line breaks /
/ this is a javadoc comment /
  • Spaces, blank lines, and tabs are called white
    space. Extra white space is ignored.

4
Comments and JAVADOC
5
Comments and JAVADOC
6
First Program
public class FirstProgram public static void
main(String args) System.out.println(
My first JAVA program)
No comments
7
What is in a Name?
  • Always chose a meaningful name
  • Class names are always in capital letter
  • Long program names are ok but follow the
    upper/lower case rules.

8
The Program
9
Java Class Format
10
Java Method Format
// comments about the class
11
Writing a JAVA program in UNIX
After tying your program in pico ltctrlgtX Y ltente
rgt Once in the command prompt javac
MyProgram.java ltentergt If no errors are found,
run the program by typing java MyProgram ltentergt
12
Editing your program in UNIX
  • Log into UNIX
  • Edit your program using PICO
  • Save it
  • Compile it
  • Run it
  • Open PINE to send e-mail
  • Attach the file
  • Read the instructions carefully and send your
    program!

13
Time to Try it out
JAVA in UNIX
Write a Comment
User Comments (0)
About PowerShow.com