Read full document


  • By
  • April 2011
  • 2326 Words
Page 1 of 18
Module 2: Basic Java Programming Language
•Sun Certified Programmer for the Java 2 Platform, Standard Edition 1.2 •Sun Certified Business Component Developer for java 2 Platform, Enterprise Edition 1.3 •IBM Test 486 Enterprise Connectivity with J2EE 1.3 •IBM Test 287 Enterprise Application Development with IBM WebSphere Studio, V5.0

BrainStream Co., Ltd.,

l Language Fundamentals l Operators and Assignments l Flow Control

BrainStream Co., Ltd.,2

Source Files
l All Java source files must end with ".java" l Source file should contain, at most, one top-

level public class definition. l if a public class is present, class name should match the unextended filename. public class Demo{} class Ok{} class Yes{}
BrainStream Co., Ltd.,3

Top-Level Elements

1. 2. 3.

These elements are not required. If they are present, then they must appear in order: Package declaration package javafun.lab2; Import java.util.Vector; Import statements import java.awt.*; Class definitions public class Demo{ }

BrainStream Co., Ltd.,4

l Package: source placed in directory

hierarchy that reflects package names.
package javafun.lab2; Import java.util.Vector; import java.awt.*; public class Demo{ }

BrainStream Co., Ltd.,5

Current Directory C:\

Change to E:\

BrainStream Co., Ltd.,6

Class Path
l Use Jar file in class-path “c:\utils.jar”

BrainStream Co., Ltd.,7

Class Path
l Use –classpath “.” means current directory.
Current Directory C:\


BrainStream Co., Ltd.,8

Package Recommendation
l .
– – –** org.omg.* com.brainstream.iself.* com.brainstream.iself.applet.* com.brainstream.iself.servlet.* BrainStream Co., Ltd.,9

l .
– – –

l Import: either an individual class &


package javafun.lab2; import java.awt.*; import java.util.Vector; public class Demo{ } BrainStream Co., Ltd.,10...

Rate this document

What do you think about the quality of this document?

Share this document

Let your classmates know about this document and more at