Try this. Create a file Test.java and put this class, compile and run.
class Test { public static void (String[] args) { MyRobot robot = new MyRobot(); robot.displayWords(); } } ----------------------------------------- Experience is what you get when you didn't get what you wanted. Don't bail; the best gold is at the bottom of barrels of crap. -- Randy Pausch A diamond is a chunk of coal that is made good under pressure. --anonymous --- On Sat, 12/5/09, uTkArsh <utkarsh60...@gmail.com> wrote: From: uTkArsh <utkarsh60...@gmail.com> Subject: [java ee programming] Java Programming Question, Please help its urgent.? To: "Java EE (J2EE) Programming with Passion!" <java-ee-j2ee-programming-with-passion@googlegroups.com> Date: Saturday, December 5, 2009, 6:54 PM I have this code for a program which do not have a main method. now i wanted to make another file or class which uses this code to get the output whatever it is. so can someone please help me by letting me know th coding by which i can get an output. The coding i have is as under. Thanks public class MyRobot { protected String model = "Asimo"; protected String make = "Mitsubishi"; protected String[] words = { "hello", "good", "excellent", "awesome", "bad" }; protected String[] lessWords; protected String[] newWords; //get methods public String getModel() { return model; } public String getMake() { return make; } public String[] getWords() { return words; } //set methods public void setModel(String myModel) { model = myModel; } public void setMake(String myMake) { make = myMake; } public void setWords(String[] myWords) { words = myWords; } //default constructor public MyRobot() { System.out.println("This is a default MyRobot() Constructor!"); } //overloaded constructor public MyRobot(String model, String make) { this.model = model; this.make = make; System.out.println("This is overloaded MyRobot(String model, String make) Constructor"); } //method learnWord public String learnWord(String newWord) { boolean isNewWord = false; for (int i = 0; i < words.length; i++) { if (words[i].equalsIgnoreCase(newWord)) { System.out.println("Word Exists"); return ("This is a Valid Word"); } else { isNewWord = true; } } String[] newWords = new String[words.length + 1]; if(isNewWord) { for (int i = 0; i < newWords.length -1; i++) { newWords[i] = words[i]; } newWords[newWords.length -1] = newWord; words = newWords; } return "Valid"; } //method forgetWord public String forgetWord(String word){ if(words.length > 0) { boolean wordExists = false; int indexfound = -1; for(int i = 0; i < words.length; i ++) { if(words[i].equalsIgnoreCase(word)) { wordExists = true; indexfound = i; } } if(wordExists) { String[] lessWords = new String[words.length -1]; for (int i = 0; i < words.length; i++) { if(i < indexfound) { lessWords[i] = words[i]; } if(i > indexfound) { lessWords[i - 1] = words[i]; } } words = lessWords; } else { System.out.println("Word does not Exist"); } } return "Valid"; } //method displayWords public void displayWords() { System.out.println("The Model is " + getModel()); System.out.println("The Make is " + getMake()); if(words != null) { for (int i = 0; i < words.length; i++) { System.out.println("The Words Array are " + words[i]); } } if(lessWords != null) { for(int i = 0; i< lessWords.length; i++) { System.out.println("The lessWords Array are " + lessWords[i]); } } if(newWords != null) { for(int i = 0; i < newWords.length; i++) { System.out.println("The newWords Array are " + newWords[i]); } } } } -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en