Java Crash Course: Calling functions смотреть онлайн
Java: Calling Functions
Follow along with the instructions at: https://fullstackclouddeveloper.com/course/java-for-beginners/index.html#calling_functions
Java class functions and methods define blocks of code that may receive inputs as parameters and may return an output. A function and a method are both declared with the function keyword. The only difference being a naming convention where functions return a value and methods do not.
Calling functions in this class
To call a function in this class, simply call it by function name or you can use the this keyword
String message = getMessage(name);
Or
String message = this.getMessage(name);
Calling functions in another class
To call a function in an instance of another class use the instance variable followed by a . then the function name
Another other = new Another();
String message = other.getMessage(name);
Exercise 2: Calling functions
Create a new class named Greeting with a function named hello that returns a String "Hello, World!"
public class Greeting {
public String hello() {
return "Hello, World!";
}
}
Modify our HelloWorld.java application we created in the Hello, World! lesson to call the Greeting class to say hello instead of the String literal "Hello, World!" Don't forget to use the new keyword to create a new instance of Greeting.
Here is the HelloWorld.java application again in case you need to recreate it.
HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
NOTE: One of the things I have noticed about VS Code is it is compiling our Java classes for us so they are ready to run once they are compilable.
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java Crash Course: Calling functions» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.