• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java programming, did anyone get confusd by the terms?

Nocturnal

Lifer
I am trying to read a book on Java but often get confused when the terms, class, method, object, instance, etc are used. Is a class the entire box of the program functions? And then you have method, object and instance. Is method the same thing as a object? Confusing to say the least.
 
What you're getting hung up on isn't necessarily Java, but Object Oriented Programming. You might want to look into a quick resource on OOP before dealing with how Java implements it.

Edit: Wikipedia has some quick definitions to get you started
 
An object is an instance of a class, eg. you could create a generic type 'Student' which is a class and create objects of that class, each with a different name and student number.

method = behaviors of an object/class, also called functions in other languages.

Say you create a class Dog with variables for name, type and weight.

Then you create a dog object with the unique data, "Rex", 40 lbs., Collie.

if your dog barks or eats, those are methods, eg. dog.bark() or dog.eat()

 
Originally posted by: professor1942
An object is an instance of a class, eg. you could create a generic type 'Student' which is a class and create objects of that class, each with a different name and student number.

method = behaviors of an object/class, also called functions in other languages.

Say you create a class Dog with variables for name, type and weight.

Then you create a dog object with the unique data, "Rex", 40 lbs., Collie.

if your dog barks or eats, those are methods, eg. dog.bark() or dog.eat()

Sweet. I get that example. You should be a teacher.
 
When I first started, inheritance and polymorphism were confusing, and recursion took a little while to wrap my head around, too. After practicing for a while, though, it's all second nature now. You have to just stick with it and keep writing code and it'll get clearer with time.

I know that's not the most helpful advice, but even when you start to get it, you think "oh, I get that now" and you're able to make something work for the first time. It was a bit tough,but you got it to work.

Come back to it a year later and it'll seem trivially easy if you've had a lot of practice in the meantime.

I remember the first time I had to write a linked list. It was confusing and difficult, and took forever to get it working, but I understood the concepts. I've come back and written other linked lists years later and they're a peice of cake now.
 
Oh know, thank you Tyler. You once helped me with binary and I thought I would never get it. Today I am able to succesfully convert binary to decimal, and vice versa along with hex and so fourth. Thanks for your insight.
 
Back
Top