import java.io.*; import java.util.*; public class l1 { public static void main(String [] args) { System.out.println("enter a value"); DataInputStream did =new DataInputStream(System.in); System.out.println("lakshmipanda"+ did ); } }
Maciej Kolodziej
Greenhorn
Joined: Feb 11, 2002
Posts: 26
posted
0
But what do You want to do? I can tell You what are You doing now. You created new DataInputStream attached to standard input. Than You printed dis.toString() which in this case is just class name and reference number.
MK
lp
Ranch Hand
Joined: Nov 08, 2000
Posts: 52
posted
0
Hi Actually the doubt i had was when i run this code i am getting an abstartc value and not the values entered .so i wanted to know incase i want to assign the input value to an integer format i have to parse the 'did' value ,but still mycode is giving me errors please help me in clearing this doubt
netharam ram
Ranch Hand
Joined: Aug 09, 2001
Posts: 202
posted
0
import java.io.*; import java.util.*; public class l1 { public static void main(String [] args) { try { byte[] data=new byte[50]; System.out.println("enter a value"); DataInputStream did =new DataInputStream(System.in); did.read(data); System.out.println("lakshmipanda " + new String(data) ); }catch(Exception e){System.out.println(e);} } } Try this out. Happy middling with java. Netharam.