• Post Reply Bookmark Topic Watch Topic
  • New Topic

The idea of methods and how to use them throughout the code  RSS feed

 
Justin Robbins
Ranch Hand
Posts: 121
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's my understanding that inside of methods is where all the action happens in the code. And we can access the instance variables and static variables inside of a method and create our own variables too. An example I can think of is like:



I thank you for reading. Would be very thankful if someone could please explain this. I feel very confused.
 
Justin Robbins
Ranch Hand
Posts: 121
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another question I have is, is that the purpose to do something meaningful to the instance variables or static variables?
 
Junilu Lacar
Sheriff
Posts: 11476
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that it's useful to discuss your example because your example code does nothing that's sensical or useful nor is it doing anything that remotely approaches what the abstractions represented by classes, objects, and methods are supposed to help you do.

I think it's better if you first go through the Java Tutorials track on object-oriented programming: https://docs.oracle.com/javase/tutorial/java/javaOO/ and try to understand the OO concepts behind the Java constructs and how they come together in a program.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!