public class _3varargs { public static void main(String[] args) { Demo a1 = new Demo(); System.out.println(a1.add(20,4)); System.out.println(a1.add(3,6,3,2,7)); } } class Demo{ int add(int ...a){ int s=0; for(int i:a){ s+=i; } return s; } }
Mai apko paise kaise bhej skta hu, Aap bohot accha padhate hain, Mai bta nhi paunga shabdo me ki kitni help milti hai apki video ki teaching style dekh k seekhne me. Thankyou sir 👌🔥🔥🔥🤧🙌
Class a{ Void demo( int...a) { Int sum=0; Sum+=a; S.O.P(sum); } Main method { A v=new A(); v .demo(); v .demo(1);();-------------->argument v .demo(2,3);();-------------->argument v .demo(2,3,4); } Class b{ static int add( int...a) { Int sum=0; Sum+=a; S.O.P(sum); } Main method { System.out.println( add()); System.out.println( add(1)); System.out.println( add(1,2)); System.out.println( add(1,2,3)); } Sir mera doubt hai ki class A me void baaye to main method me v.demo( 1,2) Aur class b me static return type banaye to main method me System.out.println( add(1,2)); Class b me Bina system.out.println Na use kerke sida add( 1,2) ker skate hai kya plz reply sir😊
Ek doubt he sir , agar int ... a -> ek array of integers ki tarah use ho raha he toh hum isko int[ ] a kyu nehi likh sakte, akhir kyu var-args ki jaroorat padi , jab ki ye array se bhi ho jayega ?
Sir my semesters arr going great just because of you . Awesome sir ❤
Sir your teaching is very better.
amazing way of teaching
public class _3varargs {
public static void main(String[] args) {
Demo a1 = new Demo();
System.out.println(a1.add(20,4));
System.out.println(a1.add(3,6,3,2,7));
}
}
class Demo{
int add(int ...a){
int s=0;
for(int i:a){
s+=i;
}
return s;
}
}
This is without void type method -
nice teaching sir.
Good morning sir 12like 🥳🥳🥳
Great
Mai apko paise kaise bhej skta hu,
Aap bohot accha padhate hain,
Mai bta nhi paunga shabdo me ki kitni help milti hai apki video ki teaching style dekh k seekhne me. Thankyou sir 👌🔥🔥🔥🤧🙌
Wlcm, and thank you so much apke pyar ke lie
Awesome
Excllent
No words ubhave saved my day
God bless u
awesome concept☺☺☺
Sir aap kha se hi kabhi apne baare me bhi koi video banaiye na please ☺️
🙏
Thank you sir 💕
Nice sir ❤️ from deep of my heart
buddy u were Awsome!!!!!
Thank you
what if the value we are passing are of differernt datatype?
Sir add method static hona chahiye na
Nice video sir G
Good night
Class a{
Void demo( int...a)
{
Int sum=0;
Sum+=a;
S.O.P(sum);
}
Main method
{
A v=new A();
v .demo();
v .demo(1);();-------------->argument
v .demo(2,3);();-------------->argument
v .demo(2,3,4);
}
Class b{
static int add( int...a)
{
Int sum=0;
Sum+=a;
S.O.P(sum);
}
Main method
{
System.out.println( add());
System.out.println( add(1));
System.out.println( add(1,2));
System.out.println( add(1,2,3));
}
Sir mera doubt hai ki class A me void baaye to main method me v.demo( 1,2)
Aur class b me static return type banaye to main method me System.out.println( add(1,2));
Class b me Bina system.out.println
Na use kerke sida add( 1,2) ker skate hai kya
plz reply sir😊
Yes you can... but aapko method ko class name ke through call krna hoga 😊
Thanks
Welcm, please Share 🙏 please 🙏
@@LearnCodingOfficial ok sir
sir is program me ham scanner class use karke suer input le sakte hai?
Ek doubt he sir ,
agar int ... a -> ek array of integers ki tarah use ho raha he toh hum isko int[ ] a kyu nehi likh sakte, akhir kyu var-args ki jaroorat padi , jab ki ye array se bhi ho jayega ?
Sir search engine par video bnao
How user can pass multiple arguments by input
Using array in call argument
Sir suru se java padha skte hn
Complete Java suru से 👇👇👇
ruclips.net/p/PLqleLpAMfxGAdqZeY_4uVQOPCnAjhH-eT
Ap bihar se hai kya
Thanks