import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author paiman
*/
public class HelloBufferedReader {
public static void main( String[] args ) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader( System.in) );
String name;
System.out.print("Please Enter Your Name: ");
name = br.readLine();
System.out.println("Hello, " + name +"! Thank you for visiting my blog :)");
}
}
This is your world! It's not just Java
Showing posts with label Input Data. Show all posts
Showing posts with label Input Data. Show all posts
Saturday, February 5, 2011
Java Tutorial: BufferedReader Example
Posted by
Paiman
at
11:37 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
BufferedReader,
Input Data,
Java Basic,
Java Tutorial
Java Tutorial: Scanner Example
import java.util.Scanner;
/**
*
* @author paiman
*/
public class HelloScanner {
public static void main(String[] args) {
Scanner input = new Scanner( System.in );
System.out.print ("What is your name? ");
String name = input.nextLine();
System.out.println("Hello, "+name+"! Welcome to my blog :)");
}
}
import java.util.Scanner;
/**
*
* @author paiman
*/
public class RectangleWide {
public static void main(String[] args) {
Scanner input = new Scanner( System.in );
System.out.print ("Input long: ");
int l = input.nextInt();
System.out.print ("Input width: ");
int w = input.nextInt();
System.out.println("Rectangle wide: "+l*w);
}
}
import java.util.Scanner;
/**
*
* @author paiman
*/
public class CircumferenceOfACircle {
public static void main(String[] args) {
Scanner input = new Scanner( System.in );
System.out.print ("Input radius: ");
double r = input.nextDouble();
double pi = 3.142857143;
double circumference = 2*pi*r;
System.out.println("The circumference of a Circle with radius "+r+" is "+circumference);
}
}
Posted by
Paiman
at
12:16 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
Input Data,
Java Basic,
Java Tutorial,
Scanner
Leave a Message
Blog Archive
-
▼
2011
(40)
-
▼
October
(11)
- Quiz of the Day | OCPJP (35)
- Quiz of the day | OCPJP (34)
- Quiz of the day | OCPJP (33)
- Quiz of the day | OCPJP (32)
- Quiz of the day | OCPJP (31)
- Quiz of the day | OCPJP (30)
- Quiz of the day | OCPJP (29)
- Quiz of the day | OCPJP (28)
- Quiz of the day | OCPJP (27)
- Quiz of the day | OCPJP (26)
- Quiz of the day | OCPJP (22)
-
▼
October
(11)
Labels
- About Java (2)
- Ajax (1)
- Animation (1)
- Array (1)
- BufferedReader (1)
- C# (1)
- C++ (1)
- Certification (5)
- Cryptography (1)
- Download (37)
- Eclipse (1)
- EJB (2)
- Game (3)
- Hibernate (3)
- Input Data (2)
- J2ME (1)
- Java 2D (1)
- Java 3D (1)
- Java Advance (1)
- Java Basic (6)
- Java Networking (1)
- Java RMI (1)
- Java Secrets (1)
- Java Swing (3)
- Java Thread (2)
- Java Tutorial (4)
- JavaFX (3)
- JDBC (1)
- JMS (1)
- JSP (1)
- Linux (1)
- MySQL (1)
- OCPJP (34)
- Opinion (2)
- Oracle (1)
- PHP (1)
- Scanner (1)
- SCJP (1)
- SCWCD (1)
- Silverlight (1)
- Spring (1)
- Tutorial (2)
- Web Service (1)
- Wireless (1)
Powered by Blogger.