├── README.md ├── Basic.java ├── Sum_a_and_b.java ├── product.java ├── conversion.java ├── first.java ├── TwoNumber.java ├── Buffer2.java ├── Casting.java ├── Buffer.java ├── name.java ├── Second.java ├── Area_of_circle.java ├── SimpleInterest.java └── Promotion.java /README.md: -------------------------------------------------------------------------------- 1 | # JAVA_INPUT -------------------------------------------------------------------------------- /Basic.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.*; 4 | 5 | public class Basic { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | String input = sc.next(); 9 | System.out.println(input); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Sum_a_and_b.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Sum_a_and_b { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | int a = sc.nextInt(); 9 | int b = sc.nextInt(); 10 | int sum = a + b; 11 | System.out.println(sum); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /product.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class product { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | int a = sc.nextInt(); 9 | int b = sc.nextInt(); 10 | int product = a * b; 11 | System.out.println(product); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /conversion.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class conversion { 6 | public static void main(String args[]) { 7 | 8 | int a = 10; 9 | long b = a; 10 | System.out.println(b); 11 | 12 | Scanner sc = new Scanner(System.in); 13 | float number = sc.nextInt(); 14 | System.out.println(number); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /first.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.*; 4 | 5 | public class first { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | System.out.println("Enter your name"); 9 | String name = sc.next(); 10 | System.out.println("Name is=" + name); 11 | 12 | System.out.println("Enter your lacky number"); 13 | int num_1 = sc.nextInt(); 14 | System.out.println("lacky number is num_1"); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /TwoNumber.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class TwoNumber { 6 | private static final String Sum = null; 7 | 8 | public static void main(String args[]) { 9 | Scanner sc = new Scanner(System.in); 10 | System.out.println("Enter your First number"); 11 | int num_1 = sc.nextInt(); 12 | System.out.println("Enter your Second number"); 13 | int num_2 = sc.nextInt(); 14 | int sum = num_1 + num_2; 15 | System.out.println("Sum: " + sum); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Buffer2.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | 7 | public class Buffer2 { 8 | public static void main(String[] args) { 9 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 10 | String name; 11 | 12 | try { 13 | System.out.println("Enter your name: "); 14 | name = br.readLine(); // Read a line of text from the user 15 | 16 | System.out.println("Name: " + name); 17 | } catch (IOException e) { 18 | e.printStackTrace(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Casting.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Casting { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | float a = 25.100000f; 10 | int b = (int) a; 11 | System.out.println(b); 12 | 13 | // float marks = 99.999f; 14 | // int number2 = (int)number2; 15 | // System.out.println(number2); 16 | 17 | char ch = 'a'; 18 | char ch2 = 'b'; 19 | int number = ch; 20 | int number2 = ch2; 21 | System.out.println(number); 22 | System.out.println(number2); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Buffer.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.InputStreamReader; 7 | import java.util.*; 8 | 9 | public class Buffer { 10 | public static void main(String args[]) throws NumberFormatException, IOException { 11 | // scanner sc=new scanner(System.in); 12 | System.out.println("Enter a number"); 13 | // InputStreamReader is = new InputStreamReader(System.in); 14 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 15 | int n = Integer.parseInt(br.readLine());// 45 16 | System.out.println(n); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /name.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.*; 4 | import java.util.Scanner; 5 | 6 | public class name { 7 | public static void main(String args[]) { 8 | Scanner obj = new Scanner(System.in); 9 | String name; 10 | int rollno; 11 | float marks; 12 | System.out.println("Enter your name"); 13 | name = obj.nextLine(); 14 | System.out.println("Enter your rollno"); 15 | rollno = obj.nextInt(); 16 | System.out.println("Enter your marks"); 17 | marks = obj.nextFloat(); 18 | System.out.println("Name=" + name); 19 | System.out.println("Rollno= " + rollno); 20 | System.out.println("Marks=" + marks); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Second.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Second { 6 | /** 7 | * @param args 8 | */ 9 | public static void main(String args[]) { 10 | 11 | Scanner sc = new Scanner(System.in); 12 | String name = sc.nextLine(); 13 | System.out.println(name); 14 | int number = sc.nextInt(); 15 | System.out.println(number); 16 | float price = sc.nextFloat(); 17 | System.out.println(price); 18 | boolean var = sc.nextBoolean(); 19 | System.out.println(false); 20 | short s = sc.nextShort(); 21 | System.out.println(s); 22 | long l = sc.nextLong(); 23 | System.out.println(l); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Area_of_circle.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Area_of_circle { 6 | public static void main(String args[]) { 7 | // Create a Scanner object for user input 8 | Scanner sc = new Scanner(System.in); 9 | 10 | // Prompt the user to enter the radius 11 | System.out.print("Enter the radius of the circle: "); 12 | 13 | // Read the radius from the user 14 | float rad = sc.nextFloat(); 15 | 16 | // Calculate the area of the circle 17 | float area = 3.14f * rad * rad; 18 | 19 | // Display the calculated area 20 | System.out.println("The area of the circle is: " + area); 21 | 22 | // Close the Scanner 23 | sc.close(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SimpleInterest.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.*; 4 | 5 | public class SimpleInterest { 6 | 7 | /** 8 | * @param args 9 | */ 10 | public static void main(String args[]) { 11 | Scanner sc = new Scanner(System.in); 12 | System.out.println("Enter principle"); 13 | float p = sc.nextFloat(); 14 | System.out.println("Enter rate of Interest"); 15 | float r = sc.nextFloat(); 16 | System.out.println("Enter time"); 17 | float t = sc.nextFloat(); 18 | float si = (p * r * t) / 100; 19 | System.out.println("Principle:" + p); 20 | System.out.println("Rate:" + r); 21 | System.out.println("Time: " + t); 22 | System.out.println("SimpleInterest " + si); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Promotion.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | public class Promotion { 4 | public static void main(String args[]) { 5 | char a = 'a'; 6 | char b = 'b'; 7 | // char c=a-b; 8 | short q = 10; 9 | byte r = 15; 10 | char t = 'd'; 11 | byte bt = (byte) (q + r + t); 12 | System.out.println(bt); 13 | 14 | System.out.println((int) (b)); 15 | System.out.println((int) (a)); 16 | System.out.println(b - a); 17 | 18 | int x = 10; 19 | float y = 10.25f; 20 | long z = 25; 21 | double w = 30; 22 | double ans = x + y + z + w; 23 | System.out.println(ans); 24 | 25 | byte p = 10; 26 | byte n = (byte) (b * 2); 27 | System.out.println(a); 28 | 29 | } 30 | } 31 | --------------------------------------------------------------------------------