48024 Lecture 4: Applications Programming
Study 4: Methods and Strings
• There are two different kinds of methods
o Procedure does something. Its name is a verb
usually. A procedure has an effect. A procedure
can call a function. It may use local variables,
which are deleted when the method exits. It
should not return anything
o Function returns something. Its name is usually a
noun. Functions do not have effects. A function
can call a function, but a function should not call a
procedure, as this may introduce side effects.
• Both can have parameters.
• If a function changes something, this is called a side
effect.
String Functions
• String is a java class with a bunch of methods.
Boolean Functions
• Tests true or false. It will return a Boolean value.
Process – Break it down, Build it up
• Break the program down into small achievable goals that build on each other.
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
Study 4: methods and strings: there are two different kinds of methods, procedure does something. It may use local variables, which are deleted when the method exits. It should not return anything: function returns something. A function can call a function, but a function should not call a procedure, as this may introduce side effects: both can have parameters. If a function changes something, this is called a side effect. String functions: string is a java class with a bunch of methods.