Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: User input array w/ private variables

  1. #1
    Junior Member
    Join Date
    May 2021
    Thanked 0 Times in 0 Posts

    Default User input array w/ private variables

    we're studying javascripting in 9th grade ict and even after researching i still am not able to understand how to do our assignment.

    so, basically, we're supposed to make a program using arrays of objects. it has to be user input too. i understand the whole "array + user input" stuff but not the private variables. i'm not sure how to declare my variables as private. i still have 3 weeks to submit this but there's like 3 more programs we're being asked to make so help would really be appreciated. thank you!

    for better understanding, here's the instructions given to us:

    Create a program using arrays of objects: Make a student registration form with the following information:

    A. Make the user input the number of students to be registered.

    B. Make the user input the credentials of the students

    first name, last name, course, year, section

    C. After the user input all the credentials, make the program display all the information of each student.

    Note: Declare variables of class as private

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,708 Times in 2,658 Posts

    Default Re: User input array w/ private variables

    how to declare my variables as private
    Add the keyword private to the variables declaration:
       private int anInt = 123;   // declare variable as private
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. How can I add a user input into a 2D- array and print it?
    By Fan Zhendong in forum What's Wrong With My Code?
    Replies: 16
    Last Post: March 29th, 2019, 02:54 PM
  2. Getting user input and storing it into an array
    By J0k3r in forum File I/O & Other I/O Streams
    Replies: 15
    Last Post: March 14th, 2019, 08:09 PM
  3. Replies: 3
    Last Post: March 4th, 2013, 09:30 PM
  4. How to add to an array with user input
    By miller4103 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 12th, 2013, 10:27 PM
  5. Replies: 1
    Last Post: May 16th, 2012, 05:15 PM

Tags for this Thread