Java 01
Java 01
CS 331
Introduction
Present the syntax of Java Introduce the Java API Demonstrate how to build
stand-alone Java programs Java applets, which run within browsers e.g. Netscape
Example programs
Why Java?
Its the current hot language Its almost entirely object-oriented It has a vast library of predefined objects and operations Its more platform independent
this makes it great for Web programming
Java isn't C!
In C, almost everything is in functions In Java, almost everything is in classes There is often only one class per file There must be only one public class per file The file name must be the same as the name of that public class, but with a .java extension
What is a class?
Early languages had only arrays
all elements had to be of the same type
Name conventions
Java is case-sensitive; maxval, maxVal, and MaxVal are three different names Class names begin with a capital letter All other names begin with a lowercase letter Subsequent words are capitalized: theBigOne Underscores are not used in names These are very strong conventions!