please tell me about MyInput method!!

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
yuuy

please tell me about MyInput method!!

Post by yuuy »

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!!
Christian

Re: please tell me about MyInput method!!

Post by Christian »

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
dan

Re: please tell me about MyInput method!!

Post by dan »

set your classpath correctly, people
Post Reply