not clear with the basics of nullpont error; trying to create student database
import java.io.*;
class student1
{
String name;
int id;
public void getdata(String name1,int id1)
{
name=name1;
id=id1;
}
public void putdata()
{
System.out.println("\t"+id+" "+name);
}
}
class student
{
public static void main(String args[])throws IOException
{
BufferedReader br= new BufferedReader(new
InputStreamReader(System.in));
BufferedReader br1= new BufferedReader(new
InputStreamReader(System.in));
student1[] n=new student1[10];
for(int i=0;i<5;i++)
{
n[i].getdata(br.readLine(),Integer.parseInt(br1.readLine()));
n[i].putdata();
}
}
}
akulkarni 0 Junior Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster
akulkarni 0 Junior Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster
akulkarni 0 Junior Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
akulkarni commented: excellent for a newbie like me +1
akulkarni 0 Junior Poster
akulkarni 0 Junior Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
akulkarni 0 Junior Poster
akulkarni 0 Junior Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.