From the course: Java 8+ Essential Training: Objects and APIs
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Wrap code in static methods - Java Tutorial
From the course: Java 8+ Essential Training: Objects and APIs
Wrap code in static methods
- [Instructor] Most programming languages let you create reusable code, code blocks that you can call from multiple places in an application. These are sometimes called functions or subroutines in other languages, but in Java they're called methods, and they're always declared as members of a class. Each method starts with one or more declarations. The methods return type is required. The main method that starts up a command line application has a return type of void, meaning that it doesn't return anything. This is something that might be called a subroutine in other languages, but it's simply called a method in Java. The keyword public is an access modifier. It determines the visibility of this method to the rest of the application. The public access modifier means it can be called from anywhere. Other access modifiers include private and protected, and the absence of an access modifier has its own meaning. Static means that this method can be called directly from the class without…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
About encapsulation3m 46s
-
Use the Java runtime classes4m 45s
-
(Locked)
Wrap code in static methods5m 56s
-
(Locked)
Declare and use custom classes4m 9s
-
(Locked)
Organize code with packages3m 46s
-
(Locked)
Create and use instance methods2m 27s
-
(Locked)
Manage state with instance variables7m 31s
-
(Locked)
Declare multiple constructor methods5m 2s
-
(Locked)
Use static fields as constants5m 51s
-
(Locked)
Declare and use enum types3m 44s
-
(Locked)
Organize code with nested types4m 15s
-
(Locked)
-
-
-
-
-