i'm unable to get my entered values i initialized array to enter student record and also write functions to get this done but when i call functions i can't get any value and all output is "null"

package javaapplication10;

import javax.swing.JOptionPane;
public class JavaApplication10 {

    public int x=10;
    public int rollno[];

    public String[] name;        
       public String[] sclass;
       public int[] marks;
       public void JavaApplication10()//constructor
         rollno=new int[10];
         name=new String[10];
         sclass=new String[10];
         marks=new int[10];


       public void addrec(int a,String b,String c,int d)

       public void deletrec()

       public void viewrec()

           for (int i=0;i<=9;i++)


    public static void main(String[] args) {
        // TODO code application logic here
      JavaApplication10 objjj=new  JavaApplication10();
      String r=JOptionPane.showInputDialog("enter the roll number");
      int R=Integer.parseInt(r);
     String n=JOptionPane.showInputDialog("enter the name of student");
     String c=JOptionPane.showInputDialog("enter the class of student");
     String m=JOptionPane.showInputDialog("enter the marks of student");
     int M=Integer.parseInt(m);



In addition to the answer above you have to remove the "void" from your constructor and you shouldn't be calling your constructor as a method on line 42

This article has been dead for over six months. Start a new discussion instead.