SHUBHRANSHU SHEKHAR

Usage of getch() Function in C or C++

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; […]

Share with your Friends...
Be the First to comment. Read More

Java Program to Reverse Words in a Sentence

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 […]

Share with your Friends...
Be the First to comment. Read More

Java program to Accept Input from User Using Scanner 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; […]

Share with your Friends...
One comment Read More

Accept input Using BufferedReader Class in Java

// 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); } }  

Share with your Friends...
One comment Read More