Java methods 📞

preview_player
Показать описание
Java methods tutorial explained

#java #methods #tutorial

public class Main {

public static void main(String[] args) {

// method = a block of code that is executed whenever it is called upon

int x = 3;
int y = 4;

int z = add(x,y);

}

static int add(int x, int y) {

int z = x + y;
return z;

}

}
Рекомендации по теме
Комментарии
Автор

public class Main {

public static void main(String[] args) {

// method = a block of code that is executed whenever it is called upon

int x = 3;
int y = 4;

int z = add(x, y);

System.out.println(z);
}

static int add(int x, int y) {

int z = x + y;
return z;

}

}

BroCodez
Автор

More people should know about this series. By far the best I have seen on you tube.

stickydamper
Автор

these videos are saving my butt. I've been so lost in my coding class and you explain these concepts so simply but clearly. Thank you!

raspberrybabe
Автор

"It doesn't matter what you do."
-- Bro

shyam.upadhyay
Автор

Bro, you're the best.
Your job is priceless!

mohamadnazirissumalgy
Автор

This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro

pavelkvasnicka
Автор

I can count on you to get me thru the boot camp I'm currently in. Appreciate you bro!

Acidful
Автор

Sir You are a great teacher i swear the way u explains things are just mind blowing thank u for such type of playlist

mummahadarsal
Автор

I watch your videos religiously, they're the best on YouTube.

TheMurdok
Автор

I have an exam in 12 hours and these videos will save me
Thx bro

yousefsammar
Автор

You are so incredibly good at explaining. I wish you were my Tutor. I learned so much from your channel already. Im so grareful i found you. You are truly the best

timaya
Автор

I AM YOUR SAVIOUR (i commented and saved you)

abhijaiallgamesgamer
Автор

Random comment to appreciate this wonderful video, God Bless you man

slade
Автор

I loved the Z trick. They did not teach that in the bootcamp. It is very simple thanks

oguzoguz
Автор

This is like the 10th time brocode helped me and i'm just getting started!

dawidmateuszbudkiewicz
Автор

i am saving this channel. so i am a hero

fryingpanm
Автор

More detailed code of the provided lesson:


public class Main {

// method = a block of code that is executed whenever it is called upon

// Since we are calling the add(int, int) function inside the main() method which is a STATIC method, therefore, we also need to make the add() method STATIC.
static int add(int x, int y) {

int z = x + y;
return z;
}
// In the above function definition, (int x, int y) are called parameters.

// Since we are calling the hello(String, int) function inside the main() method which is a STATIC method, therefore, we also need to make the hello(String, int) method STATIC.
static void hello(String name, int age) {
System.out.println("Hello "+name);
System.out.println("Your age is "+age);
}
// In the above function definition, (String name, int age) are called parameters.

// Driver Code:
public static void main(String[] args) {

int x = 3;
int y = 4;

// Calling method add(int, int)
int z = add(x, y);
// In add(x, y), x & y are called arguments.
// z = 7
System.out.println(z);

// Calling method hello(String, int)
hello("Pritam", 25);
// Hello Pritam
// Your age is 25.
// In hello("Pritam", 25), "Pritam" & 25 are called an arguments.
}
}

// Important Difference Between Argument and String.

// The values that are declared within a function when the function is called are known as an argument. Whereas, the variables that are defined when the function is declared are known as a parameter.

jojovstojo
Автор

You're actually really helpful thank you :)

gz
Автор

amazing personality, love your channel!

gamerkiplaysss
Автор

Bro code! Great concept! Thanks for the lessons, bro. 😎