[nbusers] need one class to run another one??

  • From: "bolsover" < >
  • To:
  • Subject: [nbusers] need one class to run another one??
  • Date: Thu, 22 Nov 2012 03:49:11 -0500

This really is basic stuff better asked on a general Java programming list - 
but this should help...


Code:
package annual;

public class ClassOne { 

    private void runfirst() { 
       
        System.out.println("do some initial work");
        ClassTwo classTwo = new ClassTwo();
        classTwo.runsecond();
    } 
    
     public static void main(String[] args) { 
        ClassOne classOne = new ClassOne(); 
        classOne.runfirst(); 
        
    } 
}




Code:
package annual;

public class ClassTwo {
    
    public void runsecond(){
        System.out.println("do some secondary work");
    }
}



Try to get out of the habit of putting everything in the main method; it is 
not good style.






[nbusers] need one class to run another one??

zlloyd1 11/19/2012

[nbusers] need one class to run another one??

bolsover 11/21/2012

[nbusers] need one class to run another one??

zlloyd1 11/22/2012

[nbusers] need one class to run another one??

bolsover 11/22/2012

[nbusers] need one class to run another one??

zlloyd1 11/22/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close