JAVA

This section of JAVA contains source codes of many different type of Java Programs to learn the JAVA Basics. These Programs are well formatted and easy to understand.

JAVA

Postby aman_1982_2006 on August 30th, 2008, 6:31 am

Code: Select all
[b]//PROGRAM TO ACCEPT CHAR AS INPUT FROM USER AT RUN TIME AND CONVERTING COMMAND LINE ARGS INTO FLOAT VALUE.[/b]
class convert
{
public static void main(String args[])
{
char c1;
try
{
c1=(char)System.in.read();
System.out.println("char is "+c1);
}
catch(Exception e){}

float a=Float.valueOf(args[0]).floatValue();
float b=Float.valueOf(args[1]).floatValue();
float c=a+b;
System.out.println("sum is "+c);
}
}
aman_1982_2006
 
Posts: 9
Joined: August 30th, 2008, 6:18 am

Return to Java

Who is online

Users browsing this forum: No registered users and 0 guests