please tell me about MyInput method!!
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
please tell me about MyInput method!!
I want to compile and run my Java programs which contain methods called MyInput or getInt,,so on.I am sure the programs and methods are typed correctly (because I can comile them using Textpad in Lab in my University) and also they are in the same directry.But when I want to compile them using TextPad in my computer, I can not compilel these programs which contain MyInput and other methods. I really have no idea about it.Do you have any suggestions to solve this problem??please tell me!!
Re: please tell me about MyInput method!!
package verktoy;
import java.io.*;
public class MyInput
{
static BufferedReader br
= new BufferedReader(new InputStreamReader(System.in), 1);
/**Read a string from the keyboard*/
public static String readString()
{
// Declare and initialize the string
String string = " ";
// Get the string from the keyboard
try
{
string = br.readLine();
}
catch (IOException ex)
{
System.out.println(ex);
}
// Return the string obtained from the keyboard
return string;
}
/**Read an int value from the keyboard*/
public static int readInt()
{
return Integer.parseInt(readString());
}
/**Read a double value from the keyboard*/
public static double readDouble()
{
return Double.parseDouble(readString());
}
}
This i my MyInput.java and i hav no prblem to compile it in the file, but when i try to import it like this in Textpad import verktoy.MyInput; i get error. It works perfect in Xemacs though. Doy you know about this yuuy
import java.io.*;
public class MyInput
{
static BufferedReader br
= new BufferedReader(new InputStreamReader(System.in), 1);
/**Read a string from the keyboard*/
public static String readString()
{
// Declare and initialize the string
String string = " ";
// Get the string from the keyboard
try
{
string = br.readLine();
}
catch (IOException ex)
{
System.out.println(ex);
}
// Return the string obtained from the keyboard
return string;
}
/**Read an int value from the keyboard*/
public static int readInt()
{
return Integer.parseInt(readString());
}
/**Read a double value from the keyboard*/
public static double readDouble()
{
return Double.parseDouble(readString());
}
}
This i my MyInput.java and i hav no prblem to compile it in the file, but when i try to import it like this in Textpad import verktoy.MyInput; i get error. It works perfect in Xemacs though. Doy you know about this yuuy