LecArrayFor

LecArrayFor - Today: equals operator (comparing strings)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Today: equals operator (comparing strings) arrays more loops I had hoped to have the exams back by now, but I have not yet heard back from the TA. I will have them Thursday. '+' == Scanner input = new Scanner(System.in); String fromUser; fromUser = input.nextLine(); if (fromUser.equals("How are you?")) { } Containers - Loops are useful when you want to do the same thing many times. Loops are *necessary* when you do not know how many times you want to do the same thing. Variables - we declare one variable for each piece of information and give each variable a different name. I want to store every student's score for every assignment. When I write the program, I don't know how many students there will be, (nor do I know how many assignments there will be). float score1, score2, score3, score4, score5, . ..., scoren What I would like: Declare n variables (where n is a variable assigned during the program) Access the ith variable Set the ith variable arrays Two-step process 1. Declare the variable
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

LecArrayFor - Today: equals operator (comparing strings)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online