This is my first class with Java and it is kicking my ass. I am attempting to make a simple course mgmt system that i can add students to certain courses using a string array. I am totally stuck. My if statement for number == 3 is not correct and when i check the array size, im getting a not found error. Any help would be great.

oh and using NetBeans

public static void main(String[] args) throws IOException {
        // TODO code application logic here
        int courseNum = 0;
        String courseTitle;
        int courseMaxSize;
        boolean found = false;
        Course course;
        int studentUID;
        String studentName;
        double studentGPA;
        String newStudent;
        do {
            ArrayList<Course> courseArr = new ArrayList<Course>();
            Scanner console = new Scanner(;
            System.out.println("Please select from the following options:");
            System.out.println("1. Add a course");
            System.out.println("2. Add a student to a course");
            System.out.println("3. View available courses");
            System.out.println("4. Exit from system");
            int number = console.nextInt();
            if (number == 1) {
                System.out.println("Please enter Course Number");
                courseNum = console.nextInt();
                System.out.println("Please enter course Title");
                courseTitle = console.nextLine();
                System.out.println("Please enter the max size of the course");
                courseMaxSize = console.nextInt();
                String Courses = console.nextLine();
            } if (number == 2) {
                if (courseArr.size() == 0) {
                    System.out.println("There are no courses in the system");
            System.out.println("Please enter the course you wish to search for");
            course = null;
            for (int i = 0; i < courseArr.size(); i++) {
                if (course.getCourseNum() == courseNum) {
                    found = true;
            System.out.println("Please enter the student UID #");
            studentUID = console.nextInt();
            System.out.println("Please enter the Students name");
            studentName =;
            System.out.println("Please enter the students GPA");
            studentGPA = console.nextInt();
            newStudent = console.nextLine();
            System.out.println("Student added successfully. The course "+ courseNum
                    + "now has " + courseMaxSize + " students");
            if(course.addStudent() == courseMaxSize){
                System.out.println("Sorry the course is full, cannot add student");
            if(course.addStudent() != course.getCourseNum()){
                System.out.println("Sorry, that course was not found. Try again.");
        } if (number == 3) {
            if (courseArr.size() == 0){
                System.out.println("There are no courses to list");
        }while (number != 4);