Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java The Beginning. Why Java?  Currently, this is the language of the international AP course which runs Feb-Apr  FREE!  Platform-independent  Simple.

Similar presentations


Presentation on theme: "Java The Beginning. Why Java?  Currently, this is the language of the international AP course which runs Feb-Apr  FREE!  Platform-independent  Simple."— Presentation transcript:

1 Java The Beginning

2 Why Java?  Currently, this is the language of the international AP course which runs Feb-Apr  FREE!  Platform-independent  Simple to learn but powerful  Used in Flash Actionscript  Used in Android programming

3 What can Java do? Java can be used to develop many types of applications. Java Applications are standalone programs that run on the desktop. They can be:  Console apps  simple, text-based programs that support text IO to the monitor  GUI apps  can have menus, toolbars, buttons, etc. Applets run in a browser and easily shared over the Internet.

4 Java Applet In Jcreator, create a new workspace named Applets. Save your applets into this workspace. Each new applet will be a new project. Create a new Basic Java Applet. Replace all the code in it with the code from below. Note the corresponding htm file that is created for you, saving you creating it manually.

5  Java filenames must match the class name exactly.  Java is case-sensitive  Java code is compiled, creating a file with the. class extension. You can see this file in windows explorer.  Applets run through a browser, and therefore require an htm file. JCreator will create this for you, or you can create one manually.  New security on java apps has made browser testing difficult. JCreator features an applet viewer making testing easier.

6 Libraries  A library is a collection of useful classes.  Use the import statement to make a library available to your program.  You will use several libraries in this course, such as java.awt and javax.swing.

7 Structure of a Java Program  Java programs are made up of a number files called classes, each one performing a specific task.  One class in the program will contain the main() method, which the computer searches for to get things running.  An applet will have a paint() method that is called automatically when it is started.  Inside of a class we have methods and instance variables.

8 Naming Conventions  Classes are named in TitleCase  Methods are named in camelCase and always have ()  Variables are named in camelCase  Constants (aka finals ) are UPPER-CASE.

9 Java Help  The best help for java is the java api on the Internet. Try  Look up the drawString method api.

10 Close your workspace, and create a new Blank Workspace for Applications. Add a New Project named HelloWorld. It will come up similar to below. Alter yours to match this and make sure it compiles and runs.

11 Close your workspace, and create a new Blank Workspace for GUI-Apps. Add a New Project named HelloWorldGUI. It will come up similar to below. Alter yours to match this and make sure it compiles and runs.

12 An Applet with Graphics  Close your workspace and open the Applet workspace.  Add a new applet project named ShapesAndColors. The api can give you more information on possible graphics methods that you may use to create a unique image.

13 Work on Lab 01D – Robot. All required files are on the shared drive.


Download ppt "Java The Beginning. Why Java?  Currently, this is the language of the international AP course which runs Feb-Apr  FREE!  Platform-independent  Simple."

Similar presentations


Ads by Google