← Return to Richard Styner’s Stanford / ISTE Portfolio

Java Programming Practice

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
Historical topic: Java appletsModern web browsers do not run Java applets. The Applet API was deprecated for removal before Java 25 and was removed in Java 26. Treat applet examples on this page as historical object-oriented/GUI examples; for new desktop interfaces use Swing where appropriate or JavaFX/OpenJFX.

A.P. Computer Science Practice Quizzes

 

from: Bradley Kjell, Central Connecticut State University

Chapter 1: Hardware and Software

      Chapter 1a Computer Systems Quiz Flash Cards
  Chapter 1b Analog and Binary Signals Quiz Flash Cards
  Chapter 1c Computer Memory Quiz Flash Cards
  Chapter 1d The Processor Quiz Flash Cards
 

Chapter 2: Running Java Programs

  Chapter 2a Introduction to Java Review  
  Chapter 2b Small Java Programs Review  
  Chapter 2c How to Run the Example Programs Review  
 

Chapter 3: Variables and Syntax

  Chapter 3a Primitive Data Quiz Exercises and Flash Cards
  Chapter 3b Variables and the Assignment Statement Quiz Exercises
  Chapter 3c Expressions and Arithmetic Operators Quiz Exercises
  Chapter 3d Object Data Quiz Exercises
  Chapter 3e Input and Output Review Exercises
  Chapter 3f Floating Point Review Exercises
 

Chapters 4: Branches and Loops

  Chapter 4a The if Statement Quiz Exercises
  Chapter 4b The Single Branch if Statement Quiz Exercises
  Chapter 4c Boolean Expressions Review Exercises
  Chapter 4d Loops and the while statement Review Exercises
  Chapter 4e Counting Loops Quiz Exercises
  Chapter 4f Random Numbers Quiz Exercises and Review
  Chapter 4g  The for Statement Quiz     Exercises
  Chapter 4h  More about the for Statement Quiz     Exercises
 

Chapter 7: File Input and Output

  Chapter 7a Files and File Redirection Review Exercises
  Chapter 7b Reading Data with File Redirection Review Exercises
  Chapter 7c I/O using Scanner and PrintStream Review Exercises
  Chapter 7d File Input Techniques Review Exercises
  Chapter 7e Formatted Output Quiz Exercises
 

Chapter 5: Object Oriented Programming

  Chapter 5a  Objects Quiz  
  Chapter 5b Object References Quiz  
  Chapter 5c More about Objects and Classes Review  
  Chapter 5d Method Parameters Review  
  Chapter 5e Defining your own Classes Review     Exercises
  Chapter 5f Class Design Example (miles per gallon) Review Exercises
  Chapter 5g Class Design Example (checking account) Review Exercises
  Chapter 5h Encapsulation and Visibility Modifiers Quiz Exercises
  Chapter 5i Parameters, Overloading, Local Variables Review  
  Chapter 5j Object Parameters Quiz  
  Chapter 5k Objects that Contain Objects Review Exercises
 

Chapter 6: More Java Control Sttatements

  Chapter 6a Nesting Loops and Ifs Review Exercises
  Chapter 6b Sentinel-controlled Loops Review Exercises
  Chapter 6c Result-controlled Loops Quiz Exercises
  Chapter 6d  Increment, Decrement, and Assignment Operators Quiz      
  Chapter 6e  Boolean Expressions and Short-circuit Operators Quiz      
  Chapter 6f  Truth Tables and De Morgan's Laws Review      

Chapter 8: Applets and Graphics

  Chapter 8a  Applets Quiz     Exercises
  Chapter 8b  Applet Examples Quiz Exercises
  Chapter 8c  More Applet Examples Quiz Exercises
  Chapter 8d  GUI Programming Quiz      
  Chapter 8e JFrames Quiz      
  Chapter 8f  Adding Buttons to a JFrame Quiz     Exercises
  Chapter 8g Buttons and Action Events Quiz     Exercises    
  Chapter 8h  JTextFields and JLabels Quiz     Exercises    
  Chapter 8i  GUI Applications Quiz     Exercises    
  Chapter 8j  JPanel and BoxLayout Quiz      
  Chapter 8k  Radio Buttons and BorderLayout   Exercises    
  Chapter 8l  JSliders and Change Events   Exercises    
 
 
 

Chapter 9: Arrays

  Chapter 9a  Arrays Quiz     Exercises
  Chapter 9b  Common Array Algorithms Quiz     Exercises
  Chapter 9c  Arrays as Parameters Review     Exercises
  Chapter 9d  Methods that Change Arrays Quiz      
  Chapter 9e  Arrays of Objects and Linear Search Quiz     Exercises
  Chapter 9f  Two-dimensional Arrays Quiz     Exercises
  Chapter 9g  StringBuffers Quiz     Exercises
 

Chapter 10: Advanced Object Oriented Programming

  Chapter 10a Inheritance Quiz      
  Chapter 10b  Abstract Classes and Polymorphism Quiz      
  Chapter 10c  More about Polymorphism Quiz      
  Chapter 10d  Interfaces Quiz      
  Chapter 10e  The Comparable Interface Quiz     Exercises
  Chapter 10f  ArrayLists and Iterators Quiz      

Chapter 11: ArrayLists and Strings

  Chapter 11a Strings and Object References Quiz Exercises
  Chapter 11b More about Strings Quiz Exercises
 

Chapter 12: Recursion

  Chapter 12a  Recursion Quiz     Exercises
  Chapter 12b  Recursion in Java Quiz     Exercises
  Chapter 12c  Examples of Recursion Quiz     Exercises
  Chapter 12d  More Recursion Quiz     Exercises
  Chapter 12e  Recursion with Graphics     Exercises
 

Other Cool Stuff: Exceptions and IO Streams

  Chapter 80  Exceptions and Errors Quiz     Exercises
  Chapter 81  More about Exceptions Quiz     Exercises
  Chapter 82  Input and Output Streams Quiz        
  Chapter 83  Writing Text Files Quiz     Exercises
  Chapter 84  Reading Text Files Quiz     Exercises
  Chapter 85  Writing Binary Files Quiz     Exercises
  Chapter 86  Reading Binary Files Quiz     Exercises
  Chapter 87  The File Class Quiz     Exercises
  Chapter 43  The Conditional Operator and the switch Statement Quiz     Exercises
  Chapter 44  The do Statement Quiz     Exercises

Appendix

Index