This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

anyone could help me :(  RSS feed

 
grace jo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,everyone,who could help me to check what is wrong with my code here
There are 2 class. and i post what i ve done .
i use javac ,there is no problem,but......

*Code tags added by Jason to make it more readable*


[ August 19, 2003: Message edited by: jason adam ]
 
Ravi Kumarasinghe
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I don't know about this Keyboard class. However I tried your program by passing name and code as command line arguments and it worked. It created a teacher.txt and wrote
name :John
subjectcode :001
the values which I passed
The change I did to main method is as follows:
public static void main (String [] args)
{
Teacher aTeacher;
String aName;
String asubject;
PrintWriter output = null;
aName = args[0];
asubject = args[1];
try
{
output = new PrintWriter(new FileWriter("teacher.txt",true));
}
catch(IOException e)
{
System.err.println(e);
}
aTeacher = new Teacher(aName,asubject);
aTeacher.print(output);
output.close();
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!