Ok in the java course that i am taking i am givin an outline like this:
Ok so my question is in the Init(String s), how do i store the string value in the name variable?Code:public class sd { //declare a private integer instance variable to store count of diamonds; //declare a private double instance variable to store percentage; //declare a private String instance variable to store a name; //construtor bengin here... public sd() { //Initialize all instance vairables to zero; } void Init(String s) { //this method initialized the count and percentage to zero and stores the string value in the name variable } ............ String GetName() { //this method returns the name varialbe;
Is it something like s = new String(); ?
Sorry if this is a bit vague, for more info this is the actual lab go here http://www.cs.wright.edu/~rrea/lab1_142.html. Let me know if you need to see my entire code for method and object class.




Reply With Quote