Here is my code.
Code:
import java.io.*;
class Ex13{
public static void main(String args[]) throws IOException{
BufferedReader keyboard = new BufferedReader (new InputStreamReader(System.in));
String input;
int num = 0;
int sum = 0;
do {
System.out.print("Enter a positive number: ");
input = keyboard.readLine();
num = Integer.parseInt(input);
if ( num > 0)
sum += num;
}while (num > 0);
System.out.println(sum);
}
}
Compiling with javac hh.java was fine but somehow i got this error while run as java hh
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: hh
at gnu.j
ava.lang.MainThread.run(MainThread.java:102)
Caused by: java.lang.ClassNotFoundException: hh not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(URLClassLoader.java:529)
at gnu.gcj.runtime.SystemClassLoader.findClass(natSystemClassLoader.cc:27)
at java.lang.ClassLoader.loadClass(ClassLoader.java:442)
at java.lang.ClassLoader.loadClass(ClassLoader.java:377)
at gnu.java.lang.MainThread.run(MainThread.java:98)
Hmmmm.. what went wrong? How do i fix it??