User-submitted Java Projects

25
2155 reads
Adrian999's picture

Submitted by

Adrian999
Use Try-catch Blocks
The below example demonstrates how to use try-catch blocks to catch an exception. The below example encounters an Arithmetic Exception as it try's to divide 42 by 0.
Run It Now!
72
2345 reads
Handling Logic Errors in Java
The below example demonstrates how to display a logical error in the code (called a bug) The below program encounterts the bug on line 9, which actually should be: single_letter = check_word.substr
Run It Now!
27
2055 reads
Adrian999's picture

Submitted by

Adrian999
Method Reference Example
The below program demonstrates how to pass by values by references in methods. The below program defines a method named commonValue of Class Point which takes Objects of Class Point as Parameter.
Run It Now!
30
2248 reads
KingLord007's picture

Submitted by

KingLord007
Tags:

Write A Method In Java.
The below program demonstrates how to write a method in Java.
Run It Now!
30
2990 reads

November 4, 2011

Final Modifier in java.


The below example demonstrates how to Final Modifier in java. The below example declares an object g as final in method with() and if created the object, gives an error.
33
2386 reads
Roberto's picture

Submitted by

Roberto
Final Modifier in java.
The below program demonstrates how to use Final Modifier in java. The below program defines a final variables in Class Final1 named ( i, a, j) and assigns the value to them.
Run It Now!
77
2235 reads
Protected Modifier in java. - Calories Example
The below example demonstrates how to use Protected Modifier in java.
Run It Now!
69
2002 reads
Protected Modifier in java.
The below example demonstrates how to use Protected Modifier in java. The below example defines a protected class member of Class Employee named numEmployee , and accesses from Class FileProtect by c
Run It Now!
156
3107 reads

November 4, 2011

The compare Method


The below example demonstrates how to compare 2 strings in java. The below example defines two strings having value "Ape" and "App".
77
2971 reads

November 4, 2011

Declare Object


The below example demonstrates that all classes descend from the type java.lang.Object. The below example allows the user to view the superclass of class "SomeClass" & "SomeOtherClass" as output.