Skip to content

Commit c3adf46

Browse files
io file added
1 parent 951b3d3 commit c3adf46

3 files changed

Lines changed: 37 additions & 1 deletion

File tree

IO.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//Use of scanner class object
2+
import java.util.Scanner;
3+
4+
public class IO {
5+
public static void main(String[] args) {
6+
Scanner sc = new Scanner(System.in);
7+
byte a;
8+
int b;
9+
double c;
10+
char d;
11+
String e;
12+
13+
System.out.println("Enter the string");
14+
e = sc.nextLine();
15+
16+
System.out.println("Enter the byte");
17+
a = sc.nextByte();
18+
19+
System.out.println("Enter the int");
20+
b = sc.nextInt();
21+
22+
System.out.println("Enter the double");
23+
c = sc.nextDouble();
24+
25+
System.out.println("Enter the char");
26+
d = sc.next().charAt(0);
27+
28+
System.out.println("string value: " + e);
29+
System.out.println("byte value: " + a);
30+
System.out.println("int value: " + b);
31+
System.out.println("double value: " + c);
32+
System.out.println("char value: " + d);
33+
sc.close();
34+
}
35+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Java-Programs
2+
23
Please add Simple java programs so that newbies can learn.

SwitchCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Java program to demonstrate switch case
22
// with primitive(int) data type
3-
public class Test {
3+
public class SwitchCase {
44
public static void main(String[] args)
55
{
66
int day = 5;

0 commit comments

Comments
 (0)