Page 46 - CITS - CSA - TP (Volume 2) - Hindi
P. 46
कं ूटर सॉ वेयर ए ीके शन - CITS
आउटपुट:
टा 4: ै नर ास के साथ लोिटंग-पॉइंट सं ा पढ़ना उदाहरण_4
import java.util.Scanner;
public class ScannerExample4 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Prompt the user to enter a floating-point number
System.out.print(“Enter a floating-point number: “);
double floatingPointNumber = scanner.nextDouble();
// Display the entered number
System.out.println(“You entered: “ + floatingPointNumber);
// Close the Scanner
scanner.close();
}
}
आउटपुट:
टा 5: कं सोल ास के साथ टे पढ़ना उदाहरण_1
import java.io.Console;
public class ConsoleExample1 {
public static void main(String[] args) {
// Get the Console object
Console console = System.console();
if (console == null) {
System.out.println(“Console not available. Exiting...”);
System.exit(1);
32
CITS : IT & ITES - कं ूटर सॉ वेयर ए ीके शन - अ ास 84

