Usage of getch() Function in C or C++ : Like a scanf() function in c, getch() is also a predefined function to accept input and define in conio.h header file. scanf() accept only number or character as input, but getch() accept any key as input and work further. #include<stdio.h> #include<conio.h> void main() { char ch; […]
Java Program to Reverse Words in a Sentence : In Java we can reverse each word in a sentence using String Methods. In this program, we are using JOptionPane.showInputDialog() method of javax.swing package to accept input from user. In java inputs are String by default. //Java Programe to Reverse Words in a Sentence import javax.swing.*; class […]
In java, there are different ways to accept input from user, we can also accept input from user in java using scanner class. scanner class is a predefined class in java.util package, and we can type cast input in different data type. // Java program to accept input from user using Scanner class. import java.util.Scanner; […]
// Java program to Accept input Using Buffered Reader Class in Java import java.io.*; class AcceptInput { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String name = reader.readLine(); System.out.println(“Hello : “+name); } }