Pls write this java program without using scanner.. I need it pls pls.. I will mark the answer as brainliest.
Answers
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,
}
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 .