| | |
Multiple Classes
![]() |
Hi,
I'm trying the Space Invaders tutorial (http://www.planetalia.com/cursos/index.jsp). I'm on part 13, which divides the code into classes. I'm using JBuilder and when I do this, I get error messages saying that the class I put in a new Java file doesn't exist. I put the java file in the same directory as the main class.
Can somebody please tell me what I'm doing wrong?
Thank you.
I'm trying the Space Invaders tutorial (http://www.planetalia.com/cursos/index.jsp). I'm on part 13, which divides the code into classes. I'm using JBuilder and when I do this, I get error messages saying that the class I put in a new Java file doesn't exist. I put the java file in the same directory as the main class.
Can somebody please tell me what I'm doing wrong?
Thank you.
no. if there not you can use
import whatever.you.called.it;
example
to import the java.math package (standard java package) if you wish to import say all packages in java.security you could use
Some people think its bad coding practice to do this though. I don't find it that messy and i think the jre could manage it ok (it does do optermizations).
import whatever.you.called.it;
example
Java Syntax (Toggle Plain Text)
import java.math;
to import the java.math package (standard java package) if you wish to import say all packages in java.security you could use
Java Syntax (Toggle Plain Text)
import java.security.*;
Some people think its bad coding practice to do this though. I don't find it that messy and i think the jre could manage it ok (it does do optermizations).
Compile the class you just created and JBuilder will see it. Sometimes it's not quite smart enough to see classes it created itself unless they're compiled.
As to packages: no, classes don't need to be all in the same package.
And a good thing too as otherwise you'd never be able to use any of the standard library which are all classes in packages.
As to packages: no, classes don't need to be all in the same package.
And a good thing too as otherwise you'd never be able to use any of the standard library which are all classes in packages.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
![]() |
Similar Threads
- Exception in thread "main" java.lang.NoClassDefFoundError: Invaders Error (Java)
- Problem deserializing objects from multiple classes (C#)
- downloading class files (Java)
- Which of the .NET Framework Languages Is Best? (ASP.NET)
- The difference between functions and templates? (C++)
Other Threads in the Java Forum
- Previous Thread: Simple Command Line interface -
- Next Thread: sorting through an array of objects
| Thread Tools | Search this Thread |
6 @param actuate android api applet application arc array arrays automation balls binary bluetooth bold business byte c++ chat class client code codesnippet collections compare component coordinates database defaultmethod detection doctype dragging ebook eclipse educational error file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework hql html ide ideas image ingres input integer internet intersect invokingapacheantprogrammatically j2me java javaexcel javaprojects jni jpanel jtextarea julia linux list map method methods mobile mysql netbeans newbie nextline parameter php pong problem program programming project recursion recursive scanner sell server set sms sort sql string sun swing swt terminal threads tree web websites windows






