Implementing Student Record Java program Is there a better way to implement my code in Java?  I used to code this in C++ and pretty much worked right off the bat. But in Java, it is different, as it won't let me input data on the string array name.  It seems to skip and move on to ask the user for the age rather than starting on name.

package student;
import java.util.*;

public class Student {


public static void main(String[] args) {
   int i, q, z, c, b;
   int x=0;
   String[] name = new String[30];
   int[] age = new int[30];
   String[] course = new String[30];
   String[] year = new String[30];
   String[] section = new String[30];
   int menuChoice;

   Scanner input = new Scanner (System.in);

   start:
   do{

       System.out.println("\t\t\tStudent Record Menu");
       System.out.println("\t\t1. Add Student\t2. View Students\t3. Search Student\t4. Exit");
       System.out.println("Enter a choice: ");
       menuChoice = input.nextInt();

       if (menuChoice==1)
       {
           for (z=x; z&lt;=29; z++)
           {
               System.out.println("Full name:");
               name [z] = input.nextLine();
               System.out.println("Age:");
               age [z] = input.nextInt();
               System.out.println("Course:");
               course [z] = input.next();
               System.out.println("Year:");
               year [z] = input.next();
               System.out.println("Section:");
               section [z] = input.next();
               x++;
               continue start;
           }
       }
               else if (menuChoice==2)
               {
                   for (i=0; i&lt;x; i++)
                   {
                       System.out.println(name[i] + age [i] + course [i] + year [i] + section [i]);
                   }
               }

   } while (menuChoice&lt;4);

}
}
To start with OOP, you should think of the Student class as an Object, a tangible thing like a ball. Say you were given a student. What properties might it have? For example, it may have a name, a gender, a major, a list of courses, etc etc. What could you ask it to do? You could ask it to tell you its name, to tell you whether it is enrolled in a given course or not, whether it shares a course with a given other student or not, etc etc.

In your example, Students appear to have a name, an age, a course, a year, and a section. These are the values that define a student. We can begin a more OOP approach by defining a Student class that adequately stores this information about a student, and allows construction and access to these fields:

public class Student{
    public String name;
    public int age;
    public String course;
    public String year;
    public String section;

    /** Constructs a Student object with the given values */
    public Student(String name, int age, String course, String year, String section){
        this.name = name;
        this.age = age;
        this.course = course;
        this.year = year;
        this.section = section;
    }

}


Now, you may notice that everything in the above example is public. This is (almost certainly) wrong. For example, making the age field public allows anyone to walk up to a student and say "you are now -12 years old". Certainly a bug. Let's revise and only allow get access to be public.

public class Student{
    private String name;
    private int age;
    private String course;
    private String year;
    private String section;

    /** Constructs a Student object with the given values */
    public Student(String name, int age, String course, String year, String section){
        this.name = name;
        this.age = age;
        this.course = course;
        this.year = year;
        this.section = section;
    }

    /** Returns the name of this Student */
    public String getName(){
        return name;
    }

    /** Returns the age of this Student */
    public int getAge(){
        return age;
    }

    /** Returns the course of this Student */
    public String getCourse(){
        return course;
    }

    /** Returns the year of this Student */
    public String getYear(){
        return year;
    }

    /** Returns the section of this Student */
    public String getSection(){
        return section;
    }
}


Now, while a student does have an intrinsic value for their age, you can't access it directly. You can, however, ask the student how old they are with getAge(), which will tell you what you wanted to know.

Finally, let's tackle the main method you were doing in the first place. Now that we have the Student class, we can represent a (name, age, course, year, section) as a single Student object. Instead of having 5 separate arrays, one for each field, we have a single array of Students. Just add this main method to the above Student class:

public static void main(String[] args) {
   int x = 0;
   int menuChoice = -1;
   Student[] students = new Student[30]; //As a note, hard-coding this '30' is a bad idea.
                                         //Probably should be static, final const in class.
   Scanner input = new Scanner (System.in);
   do{
       System.out.println("\t\t\tStudent Record Menu");
       System.out.println("\t\t1. Add Student\t2. View Students\t3. Search Student\t4. Exit");
       System.out.println("Enter a choice: ");
       menuChoice = input.nextInt();

       if (menuChoice==1){
           if(x &lt; 30) { //Able to add new student.
               System.out.println("Full name:");
               String name = input.next();     //This was your error - should be next like the others,
                                               //Not nextLine()
               System.out.println("Age:");
               int age = input.nextInt();
               System.out.println("Course:");
               String course = input.next();
               System.out.println("Year:");
               String year = input.next();
               System.out.println("Section:");
               String section = input.next();

               //Create the new student using the given inputs
               Student s = new Student(name, age, course, year, section);

               //Place in array
               students[x] = s;

               //Increment x for next student placement
               x++;
           } else {  //Not able to add new student
               System.out.println("Can't add new student, students full");
           }
       }
       else if (menuChoice==2) {
           for (int i=0; i&lt;x; i++) {
               Student s = students[i];
               System.out.println(s.getName() + s.getAge() + s.getCourse() 
                                      + s.getYear() + s.getSection());
           }
       }
       else if(menuChoice &lt; 1 || menuChoice &gt; 4){
           System.out.println("Unrecognized menu choice; please re-enter");
       }
   } while (menuChoice != 4);

   //Do close your scanners when you're done with them to avoid a resource leak.
   //This is closing System.in (which is bad), but you're code is terminating anyway
   //so its ok
   input.close();
}


Some places you could go from here are using a List (ArrayList will do) instead of an array for student storage in the main method, because arbitrarily limiting the number of students to 30 seems silly. You could also give students more complex behavior (a list of friends, for example) to do some really cool stuff.

Welcome to Java and OOP! If there's any way I can clarify my answer let me know.