Why the following error occurring in the following programs:-
Title
Question
Prograam1=
https://drive.google.com/file/d/1ZL-XFEBM29sJeBqgf28FI28GpcFun3F_/view?usp=sharing
Program2=
https://drive.google.com/file/d/1zORCvpCtLofL0-gF46I3VAl7YPF5cCLR/view?usp=sharing
https://drive.google.com/file/d/1ZL-XFEBM29sJeBqgf28FI28GpcFun3F_/view?usp=sharing
Java General
Answers:
Program 1 : Array Instantiation is necessary before using it.
import java.io.*;
public class PoliceDATA
{
public static void main(String[] args) throws IOException
{
String s;
int marks[] = new int[7];
int i,a=0;
InputStreamReader isr= new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
System.out.println("Please enter your marks out of 50 \n");
for(i=0;i<7;i++)
{
s=br.readLine();
marks[i]=Integer.parseInt(s);
}
System.out.println("These are your marks \n");
for(i=0;i<7;i++)
{
System.out.println(marks[i]);
}
}
}
Program 2:
Hint - Import libraries for FileNotFoundException and IOException.
Login to add comment