This Notes is according to the udacity free course :
Android Development for Beginners
Lesson 3A : Object Oriented Programming
This is the most important class in this course
Define a method

Quiz for you

Ans :

H.W.
Link for class
Java method parameter
Passing Information to a Method or a Constructor

* The inputs passed to a method can be called argument.
Android Development for Beginners
Lesson 3A : Object Oriented Programming
This is the most important class in this course
Define a method
Quiz for you
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String createCalendarEventReminder(String eventName, String location, int minutesAway) { | |
String reminder = "You have an upcoming event in " + minutesAway + " minutes."; | |
reminder = reminder + " It is " + eventName + " held at " + location + "."; | |
return reminder; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int deductPoints(int pointsUsed) { | |
// Everyone starts with 100 points | |
int numberOfPoints = 100 - pointsUsed; | |
return numberOfPoints; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String findTotalTripLength(int distanceOfFirstTrip, int distanceOfSecondTrip, int distanceOfThirdTrip) { | |
// Assume we need 2 miles to go to our friend's home (where the trip will start). | |
int totalLength = 2; | |
// Then start adding in the trip length. | |
totalLength = totalLength + distanceOfFirstTrip + distanceOfSecondTrip + distanceOfThirdTrip; | |
// Form a string to display the total trip length. | |
String message = "The total trip will be: " + totalLength + " miles."; | |
return message; | |
} |
Ans :
H.W.
Link for class
Java method parameter
Passing Information to a Method or a Constructor
* The inputs passed to a method can be called argument.
留言
張貼留言