Learn Java Tutorial for Beginners, Part 13: Classes and Objects
HTML-код
- Опубликовано: 14 ноя 2024
- New complete course: www.udemy.com/...
More courses! Free C++ course: www.udemy.com/...
Make a social network with Spring Boot: www.udemy.com/...
Learn about MySQL and relational databases: www.udemy.com/...
Java desktop programming: www.udemy.com/...
Intermediate-Advanced C++ 11: www.udemy.com/...
-------------------------------------------------------------------------------------------------------------------------------------------
A basic tutorial on using classes and objects in Java, plus some discussion of what classes and objects actually are. This tutorial focuses on classes containing only data; next time I'll look at "methods".
--------------------------------------------------------------------------------------------------------------------------------------------
More videos on my RUclips channel: / caveofprogramming
So i play the video, listen to the music and hear that british accent-and i become certain: This guy can teach some CLASS
Oh man, this ten minute video made so much more sense than my two hour lecture.
and the 40 pages of my book.
I clicked on the video to learn, was greeted by some fancy piano. Top that off with a soothing British accent and some string instrumental and I felt like I had to get up and put on a suit.
You DO!
I have been surprised in every single tutorial you publish here. Really talented teacher you are and I like your voice and tone very much, how I wish that I'd have had a teacher ike you wether in the school or high school, as long as he would explain lessons as you do here for us.
Thanks John !!
Very funny :) I've been called worse things! Yes, standard practise is to use getters and setters to access instance data from outside the class. These I cover in subsequent videos. Have fun!
You can use CSound from Java, but to be honest it's complicated and strangely rubbish. I've never heard anyone successfully make good music with it. You can write software synthesizers in Java if you want to. E.g. search for caveofprogramming blind, and you'll find some code I wrote that does basic synthesis in Java. This assumes you want an ultra-low-level approach though! Better to download Psycle if you actually want to make music.
I've watched several tutorials on this subject, and this is definitely the best and most clear of all of them. Thank you.
Your voice is very comforting!
Also your explanation is very comforting.
Thanks john for all I learnt from you, I repeat and repeat your tutorials and don't get tired watching them, they are full of details which indeed like a cave of gold you should dig it more and more.
One of the better tutorials explaining classes in Java.
Thank very much Cave of Programming, your tutorials are the most concise and clear explanations on important fundamental concepts, I salute you sir!
You are such a wonderful teacher! I appreciate everything you are contributing and have learned a lot from you! Thank you, John!
You are a hero sir,
My teacher can't seem to explain anything I only wished I had happened upon this earlier in the semester
I'm a long time Java Developer and I offer only your courses to my juniors at work. Great work, keep it up!
"You can only have one public class in a file" .. no-one ever taught me this. Thankyou. :)
One public "top-level" class that isn't an inner class...
This was very helpful. I appreciate your reasonable pace and proper explanation.
Absolutely subbed.
Just start learning java from your excellent videos...you rock bro:) thank you
i won't survive java without these videos. THANKS A LOT!
Very nice, finally have an understanding of objects. Other tutorials aren't very clear at all, thanks! :D
Some more clarification: person1 and person2 are Instances of the object Person. They basicly are their own copies of the Object. If you change variables in the Instance you wont change the variables in the object Person itself. Its more like the class Person is the blueprint fpr its instances.
Almost everything in Java is made of Classes. if you invoke e.g. a String the string is an object somewhere in the library and you create an instance of it. This will become more clear during the next lesson "methods" because you've already worked with methods included in the String object.
ahh I now associate Beethoven 4 with Java programming. You're a classy guy John. haha get 'classy'....hehe...yeah I know I need to get out more.
One question though .At around 9:30 you say it's not good practise to do it like this, if so what is a better way? Thanks.
great, really very helpful tutorial 👍👍👍👍🙂🙂🙂🙂
thanks for this, the fog is starting to settle KEEP IT UP!
Cheers! I'll try to make a video on interfaces soon. There isn't one yet, it's true.
Thanks for the kind words. Much appreciated!
You have a truly soothing voice haha and I really really like you videos. I've been trying to grasp the concept of classes and objects, and I finally feel like I'm understanding. Thanks :)
your videos are the Best at breaking down Java ; Your voice sounds like Zartan from the Gi Joe cartoon. very cool
Great job on your communication skills!!!!!!!!!!!!!!!!!! Now it looks like I will have a fighting chance at learning Java and Kotlin.
Love the classic music. Made me feel like a sir for watching this.
No homo, but this man accent on point and he is using all the terms like state that are 8n my book.
+Bobby Jones I got a boner while listening to this. I don't even want to learn how to program, but I'm listening to his soothing voice to go to sleep.
italian?? Dutch, dummy
Please drop usage of this RIDICULOUS phrase _"no homo"_ - you sound INCREDIBLY insecure by saying that.
Next, learn some sense: dailycollegian.com/2011/04/26/stop-saying-%E2%80%9Cno-homo%E2%80%9D/
Wow... This video was very clear and helped me understand. Thank you!
Thanks to this tutorial I have come up with this:
>>>>>HALL OF FAME>>>>>>
very nice video!,.could u please increase font size?..because font is not visible clearly....
Finally it made sense!!! Thanks a lot.
I think you like music.....:) and one your tutorial you told about parameter (tweaking parameter).....do
you know which programming language is best for writing software synthesizer?
Well explained.
Really Really helpful :) Thank you so much
made my lecture 1000 times easier
Bro good tutorial but I think you're too close to the mic and not being loud enough which is why the air coming out of your mouth can be heard, good tutorial though like I said
keep making these videos
finally I got it!
maybe a silly question, but where you declare String in your class file, 'Person', is it possible to declare String as an array, or would it not make sense to do so since you are initializing the variables in the App file?
nice, nice voice also super chill, me like.
Very well done video.
Is this the same guy from udemy? It sounds just like him and the intro music is very similar to udemy's videos on the iphone app.
Very good video I'll have to watch it again though.
Thank u john...well explained..
Excellent!
The program cant find the main class, I have this problem when I write before public
Voice is very ASMR haha. This tutorial still applies but for new people I would recommend checking out Java 8 tutorials for the most up to date usage of Java. Don't learn old material
+King Kek any tips on where his only got one video on java 8
Locationary Personally I bought a course for 10 bucks from udemy, full video course. There are plenty of java 8 ebooks out there you can torrent (before buying ;)) and if you are into gaming it can also be useful to look up runescape java 8 bot making tutorials as it is funner for a gamer and put's things into context for you.
King Kek hahaha that's pretty funny you mention that since I use to program scripts for a runescape bot called kbot 7 or so years ago but I forgot most of the coding which is why I'm learning again
Thanks for these videos.
Thanks!
Thanks for this.
I don't understand why you need to declare what 'type' the person1 variable is?
I'm referring to the 'Person person1 = new Person()' line.
I would understand if it was like this ' person1 = new Person()' as you are creating a new object but i don't understand why there is the need for the first person.
Any help would be great.
Cheers
+thexxmaster Some languages let you miss off the type or write "auto" or "var" or something, but Java doesn't. The type of the variable doesn't have to be Person here; it could be any superclass of Person (like Object), or any interface that Person implements, depending on how you need it to work.
You can create variables without using "new" to make them point at an actual object. But since you often want to combine variable declaration with initialising the variable, many other languages let you miss off the type of the variable in this situation. Maybe Java will in the future.
Oh okay that makes more sense. Thanks a lot I appreciate it.
5:37 GENERAL KENOBI!!!!
Whoever invented Java involuted it.
If you declare a variable of type Person by putting Person person1; you get the message that it has not been initialised when you attempt to assign age and name values to it.
You need Person person1 = new Person().
The "new" is what actually creates the object containing your data and code. The bit of the left of the equals sign only declares a variable that can refer to an object.
It did work if I put, Person person1; person1 = new Person();
I thought you can only have one public class in a file but then u just went ahead and created class person right above public class App????
can I write .. string name ; and int age;
outside any class . and would make the same effect ????
+The gamer Yes, but you'll see if you continue to study programming that being able to group data together with subroutines helps massively to organise code and keep it understandable. So it's much more useful than it first looks.
hello Sir,
Here you have not declared the class PERSON as Public...so how it is getting accessed in main ??
is that ..the class person is bydefault public ?
yes. if you dont put a access modifier as public or private your class will be public
what is the purpose of `public` keyword infront of a `class` ?
ah ic..thank you sir
Great!!
my god thank you aout this for spelling it out for me
creating person/ people actually is called having sex so programmers arent that nerd how they seem
video leaked: programming class from the renaissance
Ignore this if it's explained later, but so far ...
I'm baffled that you created a new class called "Person" and defined variables (name & age) in it, but the objects of that class (person1, etc) are not actually IN that class, but in the main class. most peculiar, momma
***** Thanks, the light is slowly coming on. Sounds like the objects defined by a class actually "live" within a method - where they are used. If so ... your method tutorial is next up for me, so hopefully it'll become clear then.
Thanks again. If all this goes according to plan, I hope to find work and I will owe you a percentage of my earnings.
Got it
1.25x speed is a must
no no... i make others brains bubble out their ears :-P lol i like the video.
super annoying, the wet sound in his mouth is louder then him talking..
He needs to remove the mic from his esophagus
For more visit: ruclips.net/video/wbrWpt--cgw/видео.html
Have you heard of a glass of water?
I can hear this guy's saliva building up in his mouth goddamn
Really Badddddd >???????
Thank you!