CIS 67: Some Simple Java Programs
The Hello program:
using System.out
,
using System.in and System.out
,
using javax.swing.JOptionPane output
,
using javax.swing.JOptionPane input output
,
A simple
Point class
The
euclidean algorithm
to compute the gcd of two integers
Printing a
diamond graph
Printing n
Fibonacci numbers
Overflow and roundoff
errors
.
Printing the
integer values of the printable ASCII characters
An
example
that shows a usage of a command line parameter and of the substring method for Strings. It prints proper heads and tails of a string.
Using
Scanner on a String
Redirecting a file
to standard input
Decimal and binary representation
of an integer
Generating a
random permutation
.
The
Birthday Paradox
Collecting quarters
from all states
Linear search
Selection sort
Binary search
Insertion sort
Merging two sorted arrays
Copying a file
Merging two sorted files
A random number generator
Rotating the elements of an array
A large supply of examples of Java code, some for advanced applications, is at
http://developer.java.sun.com/developer/codesamples/
Many more examples are in
The Java Developers Almanac 1.4>