Question:
java question?
metalikidd7
2007-11-14 20:11:14 UTC
When using methods in java, under what conditions would the parameters be empty??
Three answers:
Expolorer
2007-11-14 20:22:29 UTC
That is when you are trying to do some operations that does not need any input.
2007-11-15 04:13:23 UTC
When the method requires no arguments.



In general, there are 2 types of methods: those which set values within the class and those which return the value for that instance of the class. When you're getting the value from an object, you may not require an argument to the method. You're saying just give me the value.



There are obviously other different types of methods, but those are the simplest.
?
2007-11-15 04:16:23 UTC
Methods are there so you can interact with your variables or the variables of other objects. The way to to that is to pass information back and forth through parameter passing

Pass in through parenthesis and out through return statements



public void myMethod( in x)//passing in a Type int called x

void mean no return



Public int yourMethod()//no passing anything but returning

{

int a =5

int b =6

return a=b;

}


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...