Learn programming with Java exercises

 Top 10 most viewed Java exercises

 193 Exceptions V2
Create a program to ask the user for a real number and display its square root. Errors must be trapped using "try..catch". Does it behave as you ex...
 181 Java to Pascal converter
Create a program to convert simple Java programs, such as the following one, to Pascal language...
 147 First contact with Java
Create a program (in Java) to print Hello on screen and then print your name (in a separate line)....
 117 BMP width & height, FileStream
Create a Java program to display the width and the height of a BMP file, using a FileStream. Remember the structure of the header: File type (letter...
 116 Reading a binay file (2 - GIF)
Create a Java program to check if a GIF image file seems to be correct. It must see if the first four bytes are G, I, F, 8. In case it seems cor...
 101 Pascal to Java translator
Create a basic Pascal to Java translator. It will accept program such as: example program; var i: integer; max: integer; begin writeLn("Ho...
 100 Conditional operator, positive & smaller
Create a Java program which asks the user for two numbers and answers, using the conditional operator (?), the following: - If the first number is ...
 99 Friends database, using files
Expand the "friends database", so that it loads data from file at the beginning of each session (if the file exists) and saves the data to file when t...
 95 C to Java converter
Create a program to convert simple C programs, such as the following one, to Java: Note: the resulting program must compile correctly. Test it with o...
 84 Calculator - switch
Write a program which asks the user for two numbers and an operation to perform on them (+,-,*,x,/) and displays the result of that operation, as in t...