Different Class-Files in one project
 
Here is an example of a java project, having two class files connected to each other.
In the first file, you have to import the second one and put this curious sentence inside the main method (don't ask me why ;).

File 1: MainClass.java
// the package is only for JBuilder users!
package testproject;
import testproject.SecondClass;
/*
* This is an example of a project,
* with two class files connected to each other!
*/
public class MainClass {
  public MainClass() {
  }

  public static void main(String[] args) {
    SecondClass PrinterClass = new SecondClass();
    String someword = "hello world";
    PrinterClass.printSomething(someword);
  }
}


File 2: SecondClass.java
// the package is only for JBuilder users!
package testproject;

public class SecondClass {
  public SecondClass() {
  }
  void printSomething(String printthis) {
    System.out.println(printthis);
  }
}
 
admin / Dec 03, 2004
   
 
 
Login: 
Pass: 
 
 
     
     
2004 - 2019 / lookass.ch
makememad@lookass.ch