http://java.sun.com/j2se/1.5.0/docs/api/
The above link is the the java API for version 5. If you are not familiar with the API, now is a good time to learn. It lists all the classes and the methods they have and have inherited. Go and read and become confident. Try to write code yourself. Yes, you will make mistakes, we all do. That is how you learn. You won't learn from copying any code that I post here.
If you are having trouble then post back here with your code (wrapped in code tags), post the exact error messages you get (if any) and provide a clear explanation of the trouble you have. Don't say "It doesn't work".
package palindrome;
import java.io.DataInputStream;
/**
*
* @author Pulkit
*/
class Main {
public static void main(String[] args) {
int num;
System.out.println("Enter a number to check if it is palindrome");
// System.in.readline(num);
DataInputStream ob = new DataInputStream(System.in);
}
}
Now the remark line is wat i tried to do, as i thought it should follow the print method ( System.out.print ) that one.
But in a book , i see its done just the other way, just below the rem line.
I just need ur help to explain me as to how that line has been put, i.e. the syntax of that line.
Can u please debug the above code for me ?
I am using net beans 5.5
It compiles without errors but when i run it using F6 button . . .it displays the message but does not wait for me to enter value . . . help ?
U can call it my first program . . . If u help me with this, i wud be able to do atleast 25-30% since i m master in c and c++ most of other syntaxes are same . .
OH WOWOWOWOW !!
My first program ! It worked !
THanks a lot sir, Thanks a lot.
Can u just tell me why the java.io.datainput stream method did not work ?
package palindrome;
import java.util.Scanner;
import java.io.DataInputStream;
/**
*
* @author Pulkit
*/
class Main {
public static void main(String[] args) {
int num;
System.out.println("Enter a number to check if it is palindrome");
Scanner ob = new Scanner(System.in);
num=ob.nextInt();
}
}