Join Peggy Fisher for an in-depth discussion in this video Creating user-defined functions, part of Learning Java.
- A method is a group of statements…used to accomplish a specific task.…It is sometimes referred to as a black box.…A method definition includes these parts:…a method header, which contains a visibility type,…public, private or protected,…a return data type,…a method name,…a list of parameters,…and the body of the method,…which is enclosed in open and closing curly brackets.…In the example that I have here…for my project called methods,…we have a main method…which includes a visibility modifier of public,…a return type of void,…and the name of it is called main.…
In parentheses, we list the arguments,…a string array, and the variable name…is A, R, G, S.…Here is the open and closed curly brackets…that indicate the block of code…that's considered main.…Once we have the method defined,…we need to call, or invoke, the method.…This is where some of the confusion can start.…When calling a method from our main program,…we call the method using the name…and providing any necessary parameters.…In this first program example,…
- Downloading and exploring NetBeans
- Understanding Java basics: data types, strings, arrays, and more
- Controlling flow with functions and loops
- Creating classes
- Sorting and searching arrays
- Manipulating files
- Handling errors
- Building GUIs
Skill Level Beginner
1. Getting Started
2. Java Basics
3. Flow of Control
4. Classes and Objects
5. Beyond the Basics
6. File Manipulation
7. Graphical User Interface Basics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.