Computer Science, asked by monali08, 1 year ago

Pls write this java program without using scanner.. I need it pls pls.. I will mark the answer as brainliest.

Attachments:

Answers

Answered by ams68
29
#include <stdio.h>

strct student

{

char name (50);

int roll;

float mark;

}s;

int main

printf("Enter name:");

scanf("%d", s.roll);

printf("Displaying information");

printf("Name");

puts(s.name);

printf("Roll number : %d/n, s.roll);

return 0,

}

monali08: I am a beginner.. pls give the program without scanners pls.. pls use command line argument
Anonymous: this is C++ and he asked for JAVA
monali08: Yes I need java without scanners.
Anonymous: without scanner ?? i read the question wrong .. wait
Answered by Anonymous
84

CODE

import java.io.BufferedReader;  

import java.io.IOException;  

import java.io.InputStreamReader;

class Program

{

public static void main(String args[])

{

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter the student name");

String s = reader.readLine();

System.out.println("Enter the roll number");

String r = reader.readLine();

System.out.println("Enter the name of school");

String sn = reader.readLine();

System.out.println("Student name is "+s);

System.out.println("Roll number is "+r);

System.out.println("Name of school is "+sn);

}

}

For using Scanner class , we need to import the java.util package . The inputs have to taken in String and int .

But working with Buffered reader , we need to import 3 packages : java.io.BufferedReader , java.io.IOException , and java.io.InputStreamReader .

The String is a collection of characters while int stores integer type values .


monali08: I need without scanner.. I am a beginner.
Anonymous: Sure wait .
Anonymous: yes edited . Did you understand now ?
SHARIQ2005: this is so difficult!! i admire your skills
Anonymous: not so difficult . Python is harder . Coding needs practise and passion :)
monali08: Yes ik a little bit of python it’s much more difficult than java
Anonymous: Easiest -> HTML , Javascript , CSS for web development . But JAVA provides the best career . Python will be the best in future because it features artificial intelligence .
SHARIQ2005: thanks!! i want to go in comp sc and this would help me
SHARIQ2005: although python seems more easy to me than c++ or java
Anonymous: Best of luck to all !!
Similar questions