Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


how can divide my single programs in multifiles

jargonjargon Member Posts: 1
I want to know that in java how can we divide our program among multifiles and then execute it.

for eg:
I made a new directory and inside that created these

class hello
public prnthello()
class hel
public static void main(String args[])
hello h=new hello();

then on command prompt i did:
it compiled successfully but gave the following runtime errors
D:PROGRA~1JAVA_P~1 rial>java
Exception in thread "main" java.lang.NoClassDefFoundError: hel/java
Caused by: java.lang.ClassNotFoundException:
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: Program will exit.

can anyone plz tell me the correct method to this


Sign In or Register to comment.