Side Navigation

X

Read Console Lines (3 ways)

public class BestOnlineLearning { public static void main(String[] args) throws IOException { System.out.println(“——Using buffer Reader:——– “); System.out.print(“Enter a word: “); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String s = reader.readLine(); System.out.println(s.toUpperCase()); System.out.println(“——Using Scanner class: ——–“); System.out.print(“Enter a word: “); Scanner scanner = new Scanner(System.in); String sScan = scanner.nextLine(); System.out.println(sScan.toUpperCase()); System.out.println(“——Using System Console: ——–“); System.out.print(“Enter a

Read More