• Post Reply Bookmark Topic Watch Topic
  • New Topic

in.Reader  RSS feed

 
Luqman Ghani
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.io.*;

public class FactQouter {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for (;;) {
System.out.print("FactQouter> ");

String line = new in.readLine();

if ((line == null) || line.equals("quit")) break;
try {
int x = Integer.parseInt(args[0]);
System.out.println(x + "! = " + Factorial4.factorial(x));
}
catch (Exception e) {System.out.println("Invalid Format");}
}
}
}


When I compile it, the program gives an error that "package in does not exist"

What is the problem???
What I think is that "in" is not included in my java package...
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at this line:
String line = new in.readLine();

What is it supposed to do? What are you doing wrong?
 
Luqman Ghani
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There should be no "new" in the line:

String line = "new" in.readLine();

It should be:

String line = in.readLine();
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!