package com.company; import java.util.Scanner; public class CWH_05_TakingInpu { public static void main(String[] args) { System.out.println("Taking Input From the User"); Scanner sc = new Scanner(System.in); // System.out.println("Enter number 1"); // int a = sc.nextInt(); // float a = sc.nextFloat(); // System.out.println("Enter number 2"); // int b = sc.nextInt(); // float b = sc.nextFloat(); // int sum = a +b; // float sum = a +b; // System.out.println("The sum of these numbers is"); // System.out.println(sum); // boolean b1 = sc.hasNextInt(); // System.out.println(b1); // String str = sc.next(); String str = sc.nextLine(); System.out.println(str); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter