Ask your own question, for FREE!
Computer Science 9 Online
OpenStudy (pottersheep):

Can someone help explain to me what a method is ?

OpenStudy (pottersheep):

For java

OpenStudy (pottersheep):

I don't really get return key..........how we put void if it doesn't return a value.........if it doesnt return any value doesnt that make the method useless?

OpenStudy (anonymous):

public static void printName(String name) { System.our.println(name); } not useless?

OpenStudy (jagatuba):

A method in any object-oriented programming language is the actions that an object can perform. The main method does not return a value but it is essential to any program

OpenStudy (pottersheep):

System.out.print - ing isn't consiedered returning a value ?

OpenStudy (anonymous):

A method is just a function attached to a specific class of objects.

OpenStudy (anonymous):

no, method does not return anything it just prints out to standard output

OpenStudy (pottersheep):

Ok thanks guys I'll try to research a bit more........ugh I hate my teacher.

OpenStudy (anonymous):

@Tomas.A a method can return something

OpenStudy (anonymous):

im speaking about my example

OpenStudy (pottersheep):

Sorry what exactly does "static" mean ? and what is the opposite of static?

OpenStudy (anonymous):

did you learn OOP already?

OpenStudy (pottersheep):

Object Oriented programming ? I read over the definition myself in my textbok but we didnt go indepth

OpenStudy (anonymous):

The main method of the program has the reserved word static which means it is allowed to be used in the static context. A context relates to the use of computer memory during the running of the program. When the virtual machine loads a program, it creates the static context for it, allocating computer memory to store the program and its data, etc.. A dynamic context is a certain kind of allocation of memory which is made later, during the running of the program. The program would not be able to start if the main method was not allowed to run in the static context.

OpenStudy (anonymous):

you will learn about non static in OOP

OpenStudy (anonymous):

and it's called dynamic lol

OpenStudy (pottersheep):

oh lol I dont think I need to learn that now then....since I never read anything about that.....thank you

OpenStudy (tux):

Method is part of application which does specific task.

OpenStudy (jagatuba):

Methods are the tasks or actions that an object can perform. Going back to my Corvette example that I used in explaining object instances, moving forward or backward are examples of the methods that a Corvette object can perform. Turning left and right are also methods. Methods are often inherited from a superclass. For example, Corvette could be a subclass of the superclass Car. The class Car has generic methods that apply to all car objects and are inherited by any subclass of Car (Corvette, Legacy, Lancer, ect.) The objects of these subclasses can use the inherited methods of Car and the additional methods that are offered by its subclass. Shifting the example, let's say we still have the class Car, but we have a subclass Convertible. Instances of Convertible can go forward and backward as can any instance of Car or subclass of Car, but only instances of Convertible can put their top down because that is a unique method of Convertible.

OpenStudy (anonymous):

Dynamic is something like an opposite to static.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
laylasnii13: Can i dm anybody to vent having a rough time ??
9 hours ago 1 Reply 0 Medals
kaelynw: starting to draw a hand
11 minutes ago 16 Replies 2 Medals
Twaylor: Rate it :D (Took 2 days)
9 hours ago 7 Replies 0 Medals
XShawtyX: Art, Short Writing Assignment: Imagining Landscapes
9 hours ago 4 Replies 1 Medal
XShawtyX: Chemistry, Help ud83dude4fud83cudffe
1 day ago 13 Replies 1 Medal
kaelynw: tried a lil smt, the arm is off but i like the other stuff
1 day ago 27 Replies 3 Medals
kaelynw: art igg
1 day ago 14 Replies 1 Medal
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!