Presentation is loading. Please wait.

Presentation is loading. Please wait.

Declaring variables The type could be: int double char String name is anything you want like lowerCaseWord.

Similar presentations


Presentation on theme: "Declaring variables The type could be: int double char String name is anything you want like lowerCaseWord."— Presentation transcript:

1 Declaring variables The type could be: int double char String name is anything you want like lowerCaseWord

2 Declaring Variables

3 Calling Methods This calls toLowerCase on name. It returns the name lower cased This calls length on name. It returns how many letters in the word This calls substring on name. It returns the name with cutting off the 1 st letter. So it would be “ozo” NOTE ALL OF THESE METHODS DO NOT AFFECT name

4 Saving method results

5 Bringing it all together So we will need to find a lower case version of the whole phrase, then cut off the first letter. We will also need to get the first letter capitalized and save that. That bring it all together and print it out.

6 So we will need to find a lower case version of the whole phrase, then cut off the first letter. First we lower case the phrase saving it as a String lowerCase Then cut off the 1 st letter of lowerCase and save that as cutOff This could be done shorter below:

7 We will also need to get the first letter capitalized and save that. This is a bit tricky, we are going to capitalize first, then get the first character. Again we call toUpperCase on phrase and save it as String upperCase The save first letter as char firstLetter Or shorter as:

8 In total


Download ppt "Declaring variables The type could be: int double char String name is anything you want like lowerCaseWord."

Similar presentations


Ads by Google