I was wondering... If you have a main function in a class, and then have functions in that class that instantiate a new structure defined in another class, can you work on the new structure while you're in main? Here's an example I've compressed to show what I'm trying to do:
Any suggestions?Code:import java.io*; import java.lang*; import java.util*; public class ossim{ public static int main(String args[]){ functionCaller(); /* Can you now work on the new PCB "hello" structure here */ /* such as setting hello.PID = 1 ? */ return 0; } public static void functionCaller(){ /* instantiate PCB */ PCB hello = new PCB(); } } class PCB{ int PID; /* process id number */ int priority; /* priority of process */ String statusType; LinkedList statusList = new LinkedList(); int[] crTree = new int[10]; LinkedList otherResources = new LinkedList(); }


Reply With Quote



Bookmarks