Methods/Method Overloading Flashcards
(37 cards)
A collection of related classes
Package
The term _____is used to create Java programs, either application or
applet
Class
- it is used to group a set of related operations;
- and is used to allow users to create their own data types.
Class
A set of instructions designed to accomplish a specific task.
Methods
the package java.util contains the _____ Scanner. This _____ contains the method nextInt, nextDouble, nextLine for inputting data
into a program.
Class
An application program is a collection of one or more ____
Classes
Collection of methods and data members
Class
A _____can be predefined or standard ___, such as nextInt, print, and println, which are already written and provided as part of the system
Method
public class Classname
{
classMembers
}
Syntax of Class
Public static void main (String[] args)
{
statements
}
Syntax of a method main
is a collection of statements that are grouped together to
perform an operation or a task.
Method
Methods can be: (2)
- Predefined methods
- User defined
In programming language like C and C++, methods are like ___.
Functions
We create methods to make our program modular in a sense that commonly used commands which can be put in a single block of code and then every time we want to use the methods we just _______ it in our program instead of writing the same code______.
call, from scratch
are used to divide complicated programs into manageable
pieces.
Methods
Methods that are already written and provided by java
Pre-defined method
Methods that programmer create
User-defined Methods
Advantages of using methods (4):
- You can focus on just that part of the program
- Different people can work on the same method simultaneously.
- you can right one method once and use it many times
- enhances program’s readability
In java, predefined methods are organized as a collection of classes, called _______
Class libraries
It is organized as a collection of classes
Predefined Method
Give one example of class (method)
class Math (Package: java.lang):
Pow(x,y)
Sqrt(x,y)
Max(x,y)
Min(x,y)
Round(x,y)
User defined methods are classified into two categories (2):
- Value-returning methods
- Void Methods
Methods that have a return data type
Value Returning Methods
Methods that do not have a return data type
Void Methods