public class Main { public static void main(String[] args) { // Generics = A concept where you can write a class, interface, or method // that is compatible with different data types. // type parameter (placeholder that gets replaced with a real type) // type argument (specifies the type) Box box = new Box(); box.setItem("banana"); System.out.println(box.getItem()); Product product1 = new Product("apple", 0.50); Product product2 = new Product("ticket", 15); } } public class Box{ T item; public void setItem(T item){ this.item = item; } public T getItem(){ return item; } } public class Product { T item; U price; public Product(T item, U price){ this.item = item; this.price = price; } public T getItem(){ return this.item; } public U getPrice(){ return this.price; } }
@mednmovies695916 күн бұрын
Not even interested with Java, but its nice to see you back its been a while
@MicahIMURANI16 күн бұрын
Cool 🎉
@makaalbar166315 күн бұрын
Please create a course about Golang I really really need it and I absolutely love your way of explaining things
@funnytoones992816 күн бұрын
Keep it up bro. This is amazing. We spring tutorials bro❤
@mathieucarrier421716 күн бұрын
Amazing as alway! By the way, you should do a rust serie!
@Seif28516 күн бұрын
Good ❤
@stalinseif69823 күн бұрын
PERFECT !
@chandrahaasvemula725116 күн бұрын
Course on Angular please !!!! Angular 17
@Jaybhayani_07016 күн бұрын
bro , can you make video on kotlin full couse ?
@vrushika929316 күн бұрын
JavaScript DSA
@vrushika929316 күн бұрын
DSA
@Hip-HopStateOfmind16 күн бұрын
Why making a new Java course when there are so many languages to talk about? Such as dart (maybe with flutter), Haskell and Go
@Ankitkumar-ey4ui14 күн бұрын
Because most of projects specially Banking , healthcare railway ,or any booking service are already on Java and has been going on for long time ,one of mine friend Java project is going on for 15years for Banking operation.
@wrenne_claude14 күн бұрын
Many colleges have Java in their computer science curricula, but it's also a case of learning the long way before going for the shortcut. Java is verbose, its syntax is informative and you learn many terms that in the future will allow you to understand many things way faster
@Hip-HopStateOfmind14 күн бұрын
@@wrenne_claude I completely understand that, Java is a must, but what I’m talking about is the course itself. BroCode already made a Java course, which is pretty long actually (twelve hours), with algorithms and data structures too… my point was: the last one was pretty good, why ANOTHER Java course? Did Java change that much to make about her full course about it?
@Alnz-b2b6 күн бұрын
I like this one better. Its byte size is perfect for me.