Загрузка страницы

Methods in java

Follow me on Instagram:
https://instagram.com/shinton_seg?utm_medium=copy_link

Follow me on LinkedIn:
https://www.linkedin.com/in/shinton-george/

method is a block of code which run when it is called
It is created inside class and called inside main method
Method name always start with a lowercase letter.

Example program:
// - is used for comments

public class Phone { //className = Phone

static void calling(){ //static method - calling
System.out.println("used for calling");
}

void playing(){ //non static method - playing
System.out.println("playing pubg");
}

static String recording(String name){ // parameterized method - recording
return name;
}

public static void main(String[] args) { //main method

calling(); // static method can be called without creating an object

Phone nokia = new Phone();
nokia.playing(); // non static method can be called only by creating object

System.out.println(recording("video")); //argument inside bracket
}
}
A method is a block of code that performs a specific task.
returnType - It specifies what type of value a method returns For example if a method has an int return type then it returns an integer value.

If the method does not return a value, its return type is void.
methodName - It is an identifier that is used to refer to the particular method in a program.
method body - It includes the programming statements that are used to perform some tasks. The method body is enclosed inside the curly braces { }.
To call a method, write the method's name followed by two parentheses () and a semicolon;
static method can be accessed without creating an object
non static method can be accessed by creating an object

While defining a method, remember that the method name must be a verb and start with a lowercase letter. If the method name has more than two words, the first name must be a verb followed by adjective or noun. In the multi-word method name, the first letter of each word must be in uppercase except the first word. For example:
Single-word method name: sum(), area()
Multi-word method name: areaOfCircle(), stringComparision()

methods in java for beginners
methods in java class 10 icse
methods in java in english
methods in java by durga sir
methods in java in telugu
methods in java in hindi
methods in java in tamil
methods in java by kotha abhishek
methods in java naresh technologies
methods in java by saurabh shukla
methods in java for beginners tamil
methods in java malayalam
methods in java smart programming

Видео Methods in java канала Smart Engineer
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
13 июля 2021 г. 21:48:23
00:11:50
Яндекс.Метрика