Reputation: 870
I'm writing a program which reads only integers from a text file. I have done the lions share of the program, however one thing is bothering me
When a non integer is in the text file, all the correct integers should be printed, with element not valid, replacing the element which is not valid. For example 10, 203, 2.02 10 would print 10, 203, element not valid 10 . For this do i use an array to access the part which is not valid?
Any suggestions?
Upvotes: 0
Views: 107
Reputation: 22948
If number of arguments is 2, here is how would you do it :
public static void main(String[] args) {
if (args.length != 2) {
System.err.println("Usage: ...");
}
}
Upvotes: 1