Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

how can divide my single programs in multifiles

jargonjargon Posts: 1Member
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.