File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 11# Java-Programs
2+
23Please add Simple java programs so that newbies can learn.
Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments