• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call(load) other class,see my code

 
eric lee
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have test.java and img.java.when i run test.java
and click button(actionPerformed) to load img.java
the compiler tell me wrong.below is my code.
how to fix it? Thanks.
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ February 28, 2003: Message edited by: Dirk Schreckmann ]
 
Peter Wong
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At first you must use inheritance to extends img and also put them in the same folder then you must compile those .java
 
eric lee
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter:
why it got wrong when i compile with jdk1.4?
error show:can not resolve the symbole.
G hello=new G();
but it can compile in JBuilder environment and print "hi". what' wrong with my jdk 1.4?
------------------------------------------------
public class Test {
public static void main (String[] args) {
G hello = new G();
hello.greet();
}
}
------------------------------------------------
public class G{
public void greet() {
System.out.println("hi");
}
}
 
Peter Wong
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I couldn't get any error
It is work properly
So please download latest jdk version to compile

[ February 21, 2003: Message edited by: Peter Wong ]
 
eric lee
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,peter
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic