EL ENG X429.9 First Course in Java, Spring 2015 Schedule and Syllabus


Schedule by week Syllabus Downloading Java, then configuring PATH and CLASSPATH
Java APIs, the class libraries - http://docs.oracle.com/javase/8/docs/api/
Tally of work Grading Policy Submitting Homework by Email, format and deadlines Additional:

Transportation info at: http://extension.berkeley.edu/loc/sf.html#down




Topic (and link to lecture notes)

Chapter in Textbook

Homework Assignment


03 SEP

Java Fundamentals

(pp. 1-30)
  • Students explain what they would like to get from the class.

  • Instructor explains class syllabus: weekly homework (50%) and weekly quizzes (50%) = final grade

  • Format and deadline for emailing homework

  • Lecture

  • Demo: HelloWorld and HelloCommandLineArgs

  • In-class assignment: Write, compile, and run a program that uses  multiplication, division, and modulus.

  • Homework #1: Download the SDK, configure the SDK (set the PATH), and write a program that uses the modulus operator % to return the remainder of the division of the left operand by the right operand.
    Remember to make you class name (and file name) begin with a capital letter.

  • Quiz


10 SEP

Scanner Input and Introducing Data Types and Operators

(pp. 31-61)

Homework #2: An interactive program: Prompt the user to input an integer, store the input in a variable, prompt the user for a second variable and store it in a different variable. Hint: java.util.Scanner provides the nextInt() method -  http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#nextInt%28%29

Process the two int variables using both relational and logical operators, such as > (relational) and & or | (logical), and show a result to the user. You must use at least one relational operator and at least one logical operator.


24 SEP

Program Control Statements

(pp. 63-101)
Homework #3: Write a program that uses all of the following:
  • if ...else if ... else if ... else
  • for loop
  • do-while loop
4 01 OCT Introducing Classes, Objects, and Methods 4
(pp. 103-134)
Homework #4: Write one .java file that contains three classes: two classes, such as Dog and Cat, that each define a parameterized constructor and a method. The third class (Demo.java) has the main method that instantiates the two classes by calling the parameterized constructor of each class.

For example, Dog fido = new Dog("watchdog");
The main method then calls the method on each of the  newly created objects.

For example, fido.wagTailAtRobbers();



08  OCT

More Data Types and Operators

(pp.135-179, skip pp. 166-175)

Homework #5: Write a program that uses String methods listed at http://download.oracle.com/javase/8/docs/api/java/lang/String.html

Additional options:
Study the Strings examples at

or http://docs.oracle.com/javase/tutorial/java/data/comparestrings.html

and write a program that does something with Strings that you consider useful, such as these use cases:

  • Remove the prefix "Mr. or Mrs." from a list of names, or remove the suffix ", Jr." and ", Sr."

  • Dompare two strings and find any differences or sort them lexically (alphabetically)


15  OCT

A Closer Look at Methods and Classes

including "overloaded" methods: the feature that allows using the same name for two or more method  versions


(pp. 181-223)

Homework #6: Overloading - Write a program that defines a class with an overloaded constructor and an overloaded method. For example,

 - SavingsAccount constructors for no initial deposit and with initial deposit

 - calculateInterest method for SavingsAccount and for CheckingAccount

 - Make sure the class name is a noun that begins with a capital letter, such as Account, and method name is a verb, such as getName.

Optional Challenge: include a method that calls a constructor and/or a constructor that calls another constructor using the keyword this() - http://www.write-technical.com/126581/session6/session6.htm#Overloading%20Constructors


22 OCT

and overriding the inherited version

(pp. 225-266)


Homework #7: Write a program in which you create a class, a subclass of that class, and a demo class with main. The subclass must override a method inherited from its immediate superclass and use the keywords this and super to make use of both versions. For example, if StateTax is a subclass of FederalTax, a method in the subclass might call both this.calculateTax() and
Another example: a method in the subclass might call
and super.getInterest(isChecking).
The main method must show the results of the method calls.

Optional challenges:
--Use this. and super. to reference fields and/or super()or super(arg) to call a constructor.
--Use the keyword final (which exists at three levels, class, method, local variable)
-- Use an abstract class

A possible scenario:

(1) Create an abstract class, AbstractRestaurant, with both an abstract method, calculateTax() and a non-abstract method, getPretaxPrice().
(2) Subclass AbstractRestaurant with NewYorkStateRestaurant, and make this NewYorkStateRestaurant implement calculateTax() with the rate of 4.0%.
(3) Make a subclass of NewYorkStateRestaurant called NewYorkCityRestaurant that overrides calculateTax() such that this.calculateTax() charges 12.875%. Call both this.calculateTax()and super.calculateTax(). Note: these rates are official and posted at http://ny.rand.org/stats/govtfin/salestax.html)


29 OCT

Packages and Interfaces

(pp. 267-298)

Homework #8: Write an application that involves an interface with two methods, two classes that implement the interface, and a Demo class that exercises the implemented methods on both kinds of objects.
For example, an IAnimal interface in one file named IAnimal.java that specifies the speak() and eat() methods.

Implement the interface in Dog.java, and Cat.java. Put the main method in AnimalDemo.java. Email an executable .jar file (not a .zip file) that includes the .java files, the .class files, and the manifest file that specifies the main class. See the "JAR instructions" in the lecture notes - http://www.write-technical.com/126581/session8/session8.htm#Jar%20instructions

This means a total of 4 .java files, 4 .class files, and 1 manifest.txt file all contained within 1 .jar file.


05 NOV

Exception Handling, and intro to java.io

Chapter 9 (pp. 299-327) Homework #9: Write a program with exception handling that uses try, catch, and finally (or add exception handling to one of your earlier programs). The program must catch both a standard and a custom exception. Do NOT redefine an existing standard exception.


12 NOV


Threads, Applets, Generics (intro)

Chapter 10 (pp. 329-370)

Chapter 11 (pp. 371-408)

Homework #10: Write a program that writes characters the user enters at the keyboard to a file named KeyboardInput.txt.
  • Review of previous chapters to access what we learned
  • Learn about  Threads and Applets
  • Homework #11 in class: Write a program that uses multiple threads.
  • Calculate course grades
  • Fill out course evaluation form


Textbook (required)

6th Edition (2014)

by Herbert Schildt
McGraw Hill/Osborne
600 pages.
Its code samples are at http://www.mhprofessional.com/getpage.php?c=oraclepress_downloads.php&cat=4222 and a PDF of the first chapter (5th ed.) is at http://www.mhprofessional.com/downloads/products/0071606327/01-ch01_6327.pdf

Available in paper from Amazon for $26

or $26 from Barnes and Noble: http://www.barnesandnoble.com/w/java-sixth-edition-herbert-schildt/1120732239?ean=9780071809269

$40 from Oracle Press

Other Books To Consider

An introduction similar to our textbook, but more comprehensive and with less guidance for the non-programmer:
Java: The Complete Reference
Nonth Edition (201)
by Herbert Schildt
McGraw Hill/Osborne
1000 pages

Entertaining, conversation style that includes photos, cartoons, puzzles, humor. Assumes knowledge of scripting. Covers Java 5 but the current version is Java 8.
Head First Java, 2nd Edition
by Kathy Sierra & Bert Bates
ISBN: 0596007736 ($30)
Free e-book at http://it-ebooks.info/book/3214/

Handy reference if you do not want to use the API Reference at http://docs.oracle.com/javase/7/docs/api/
(also has a brief introduction for people who are already programmers):
Java in a Nutshell, 6th Edition
http://shop.oreilly.com/product/0636920030775.do 2014

More thorough and detailed than what we cover in this introductory course.
Best for people with a C/C++ background. Introduces the Eclipse IDE.
Learning Java, 4rd Edition (2013)
- covers Java 7
Patrick Niemeyer
856 pages, $40

Course Description 


An elective in the Post-Baccalaureate Certificate in Information Systems and Management and in the Professional Sequence in Database Management

Java—with its platform independence—is heavily used in Web applications and middleware that work on Windows, Macintosh, UNIX and other platforms. Examine fundamental programming concepts, and get an introduction to object-oriented programming. Upon successful completion of the course, you are able to write simple applications and are prepared for courses that assume some familiarity with Java.

You do not need any background in programming to succeed in this course, and Java is easier to learn than C or C++.

You are welcome to bring your own laptop. The classroom does not provide computers but does have free wireless Internet access. Download Java SE 7 at www.oracle.com/technetwork/java/javase/downloads/index.html and see the configuration instructions at www.write-technical.com/126581/session1/syllabus.htm#Download.

X429.9 (2 semester units in EECS)

Grading Policy

Criteria for Grading the Homework


You are responsible for your work. You do not have to contact the instructor with a reason of absence.


If you decide to withdraw, it is your responsibility to make sure that U.C. Berkeley Extension processes your withdraw request and removes your name from the final grading form. If your name appears on the official grading form, the instructor will assign you the grade you earned at the end of the course.

Grading Options for UCBX Courses

·        CLG - Credit-Letter-Grade is the normal grading option.

·        P/NP - Pass/No-Pass. Requires 70% for a Pass.

·        C/NC - Credit/No-Credit. A grade of No Credit will be assigned if you have done
insufficient work for any of the other grading options.

·        W - Withdraw. If you cannot complete the course, you will normally be assigned a
grade of NC. Under certain circumstances, you might be eligible to "Withdraw" from the
course. You must initiate this action directly with UC Berkeley Extension.

·        INC - Incomplete. If you have completed 60% of the course work, but cannot finish the
work by the end of the term, you are eligible for an Incomplete. You must get the form from Extension and have me sign the form by the last day of class, then make a copy for your records. I will submit the form along with the course grades and keep a copy for clearing the incomplete. See the section below: "Clearing Incompletes".

Method of Assigning Course Grades

·        If you earned a 'B' or better, I assign the earned grade.

·        If you have at least a 70% AND you have requested the P/NP option, I assign a grade of Pass. 

·        If you have not completed 60% of the course work, I assign a grade of No Credit.

If you have done 60% - 79% of the course work and have not requested P/NP, I assign an Incomplete.

Clearing Incompletes

If you received an Incomplete, you have 90 days from the last class meeting.
to submit all remaining work.
To clear an incomplete, email all the remaining work on one day in a zip.

Remember to identify each assignment with your full name, the term it pertains to, and the name
and EDP number of the course it pertains to.

Clearing incompletes involves significant administrative overhead on my part. To minimize
the work, I only address the clearing of incompletes once a month, on the last weekend of the
month. Therefore, it may actually be several weeks before I clear an incomplete once all work
has been submitted. When you see the updated grades on the website tally, contact
Extension directly to get an updated transcript.

Tally Page of Grades for Quizzes and Homework

See explanations on the Tally page.

Submitting Homework and Quiz


The email Subject line should follow this format:
Email SUBJECT line: s03jh, Homework #1    [where "jh" represents firstNameInitial LastNameInitial for the student's name, in this case, Jimi HENDRIX]

The attached Java source code file must contain the following:

  • a comment header that:

  • your source code and comments

The header comment should follow this format:

Email Address, Deadline, and Late Penalty

Download and Configure the Java Development Kit, Standard Edition - Java SE 8

[see also the complete Schedule and Syllabus: http://www.write-technical.com/126581/session1/syllabus.htm ]

For Windows, Linux, or Mac:

  1. To verify whether you already have Java configured, start a command prompt (or terminal), and type java -version
    • If you see java version "1.8.0" or higher, you are already configured.
  2. Go to http://www.oracle.com/technetwork/java/javase/downloads/index.html?ssSourceSiteId=ocomen

    and download Java SE 8u5  (or higher)
    Make sure you choose the JDK option, NOT the Server JRE or JRE.
    The JDK (Java Development Kit), which allows you to compile your own programs.
    Do NOT download the JRE (Java Runtime Environment), which merely allows deployed applications to execute.
  3. Accept the license agreement and download the version for your platform. For example:

    XP is 32-bit, but most installations of Windows 7 are 64-bit.
  4. Click Save File, and make note of the path to which the installer is downloaded.

    TIP: On Windows, create your own c:\java folder and install into that. Many Windows users do not have permissions to the Program Files folder.
  5. Navigate to the directory to which you downloaded the installer.
  6. Launch the installer application.
  7. Grant permission for the installer to run.
  8. Follow the instructions of the installation wizard.
  9. Note the directory in which the JDK is being installed.
  10. If the installer launches a secondary installer for Java FX, do not install Java FX.
  11. To verify the installation:
    Mac: open a Terminal
    Windows: open a command-line console (On the Start menu, run "command"), type

    java -version

    and press Enter.
    You should see something similar to the following:

    java version "1.8.5"
  12. Verify the location of your installation:

    Mac: in a Terminal, type which java
    Windows: verify that the installation folder has a \bin\ subfolder that contains javac.exe, the compiler, and java.exe, the interpreter.
  13. Copy to a text editor or write down the exact path to the bin directory.
  14. Create a text file named HelloWorld.java as a test application with the following code and remember, Java is case-sensitive:

    class HelloWorld

      public static void main(String[] args)
        System.out.println("Hello World!");

  15. In a command console or Terminal, cd to the directory with HelloWorld.java and type javac HelloWorld.java
    and remember, Java is case-sensitive.
  16. Verify that the compiler produced bytecode:
    Mac: type ls
    Windows: Type dir
    The list should contain HelloWorld.class.

Troubleshooting 'javac' is not recognized and setting the PATH on Windows

  1. Note that you are likely see this message:
    'javac' is not recognized as an internal or external command,
    operable program or batch file.

    This means that the Windows PATH environment variable is not configured to find the javac compiler.
    [For Mac, see http://www.write-technical.com/126581/session1/syllabus.htm#Apple_ ]
  2. To find out if you can invoke the compiler with the full path, at the command prompt, type:

    "C:\Program Files\Java\jdk1.8.0\bin\javac" HelloWorld.java

    where jdk1.8.0 represents the directory that contains the bin directory and
    quotation marks envelope the path to ensure it is parsed as one string, even if it contains blank spaces.
  3. Type dir and verify the existence newly created file, HelloWorld.class.
  4. Close this console.

    We now want to set the PATH so that we can invoke javac without explicitly providing the full path.
  5. Remember the path to bin, which might be C:\Program Files\Java\jdk1.7.0_21\bin
  6. Go to Start > Control Panel > System > Advanced.
  7. Click Environment Variables.
  8. Under System Variables, select PATH and click Edit.
  9. Left-arrow to the beginning of the PATH and paste in the following at the beginning of the PATH:
    C:\Program Files\Java\jdk1.8.0\bin;
    which represents the path to the compiler, inside the bin subdirectory, followed by a semicolon, which is ;
  10. Click OK until the Control Panel closes.
  11. Open a new console window, navigate to your test application, and type javac HelloWorld.java
    and remember, Java is case-sensitive:
  12. Verify that the prompt returns with no message.
  13. Type dir *.class to see if the compiler created a file named HelloWorld.class
  14. Type java HelloWorld and press Enter,
    and remember, Java is case sensitive.
  15. Verify that you see the output, "Hello World!"

Troubleshooting class not found by setting the CLASSPATH

  1. IF you get a message saying something like "class not found", you must create or update your CLASSPATH environment variable to point to the current directory. Follow the instructions for PATH, but this time update or create a new variable call CLASSPATH and set its value to
    that is a period (.) with nothing before or after the period.
  2. Close any open console window.
  3. Start a new console window, type java HelloWorld and press Enter,
    and remember, Java is case-sensitive.
  4. Verify that you see the output "Hello World!"

Note: Another version of this information is http://docs.oracle.com/javase/tutorial/essential/environment/paths.html

Apple Macintosh OS X

The Java SDK is preconfigured on Mac OS X but users need to download a text editor, such as

Use a Text Editor, not Notepad or Word

For this First Course in Java, we recommend that you write your source code using a text editor you like.
Some text editors feature "syntax highlighting", that is, color to your source code to indicate the type (comments, keywords, strings, brackets, numbers).
Some provide shortcut keys that make it easier to compile and run a command-line application.

  1. UltraEdit-32: http://www.ultraedit.com/ ($60: with more features - more than is needed for this class)
  2. JEdit, a text editor written in Java: http://sourceforge.net/projects/jedit/ and perhaps a good choice for Mac users
  3. The following lack essential features of a Java editor and are NOT recommended:
    • Notepad - no color coding (free with Windows, but not the best choice for learning Java)
    • Word--save as text - (free with Windows, but not the best choice for learning Java)
    • vi or emacs (UNIX)
    • SimpleText (Mac)
  4. Sublime Text, which runs on Windows, Mac, Linux and supports many other languages besides Java: http://www.sublimetext.com/ No cost for evaluation, and evaluation has no definite time limit.

Integrated development environments (IDEs) with sophisticated features are good for developing large, enterprise level applications involving many developers. I do NOT recommend them if this is your very first programming course because gaining familiarity with a new tool costs time, can distract the student from the fundamental language concepts, and can complicate the submission of your homework by email.

Some students are already using Eclipse, which is free. I list  some IDEs for your information but do NOT support your use of them for this course.

While you type, Eclipse Code Assist shows the possible choices, along with help about the currently selected option:

Additional IDEs:

How to copy output from the DOS window

  1. Click the icon for the command prompt, which is in the top left corner. A menu appears.
  2. Select Edit > Mark
  3. Drag your cursor over the characters that you want to mark for saving. This selects the text.
  4. To copy the text to the clipboard, press the Enter key.
  5. Paste the text in your source code file.
  6. Recommended: use Edit > Properties to configure the console for QuickEdit Mode:

TIP: Use the Up Arrow key to cycle through previous commands. This saves you from having to retype them.

File System Navigation Commands, such as dir and cd ..

DOS-style commands often used at the command line:

More commands are listed at http://www.computerhope.com/msdos.htm#02

About the instructor

Thomas Albert has taught First Course in Java for the following terms:

  1. Spring 2014
  2. Fall 2013
  3. Summer 2013 (EDP 155366)
  4. Spring 2013 (EDP156240)
  5. Fall 2012 (EDP 158287)
  6. Summer 2012 (EDP 154286)
  7. Spring 2012 (EDP 303776)
  8. Fall 2011 (EDP 311100)
  9. Summer 2011 (EDP 315440)
  10. Spring 2011 (EDP 306936)
  11. Fall 2010 (EDP 318063)
  12. Summer 2010 (EDP 304147)
  13. Spring 2010 (EDP 3235834)
  14. Fall 2009 (EDP 311944)
  15. Summer 2009 (EDP 305375)
  16. Fall 2008 (EDP 318402)
  17. Spring 2007 (EDP 306969)
  18. Summer 2006 (EDP 304758)
  19. Fall 2005 (EDP 321299)
  20. Summer 2005 (EDP 305789)
  21. Spring 2005 (EDP 126581)
  22. Fall 2004 (EDP 128645)
  23. Summer 2004(EDP 124115)
  24. Spring 2004 (EDP 123158)
  25. Summer 2003 (EDP 135277)
  26. Spring 2003 (EDP 306704)

He is Advisory Technical Writer for Software Developer Documentation at Accelrys, a global firm that serves the biotech and pharmaceutical research industries with Java-based middleware, .NET and web-based electronic laboratory notebooks, and chemical databases.
He writes sample code, syntax reference, and developer guide documentation involving Java, .NET, and the Cheshire scripting language for chemical structure database normalization.
He has 18 years experience in publishing technical information about software and 13 years experience teaching at the college level.
He holds a UC Berkeley Extension Certificate in Computer Information Systems, a doctoral degree in English, and a bachelors degree (with High Honors) in Political Science from U.C. Berkeley.

last updated: 05-MAY-2014
Copyright © 2002 - 2014 granted to the Regents of the University of California