Can char variable type be used in a Java method? Can the method using char be overloaded? If so can I get an example!! It doesn't need to be code I am just trying to figure out if you can use char in methods??
5 replies to this topic
#1
Posted 19 March 2011 - 08:03 AM
|
|
|
#2
Posted 19 March 2011 - 08:43 AM
Yes,
You can overload any type, return any type and receive any type.
public char somecharfunc(char a, char b) {
return a;
}
public char somecharfunc(char a) {
return a;
}
You can overload any type, return any type and receive any type.
#3
Posted 19 March 2011 - 09:33 AM
Ok..thanks..so it is easy to assume you cannot mix the variable types for obvious reasons, exmple........
This would be incorrect, right?
public int intOne(double val1, char b)
This would be incorrect, right?
#4
Posted 19 March 2011 - 11:08 AM
No, this is correct, you just need to make sure it returns a int.
#5
Posted 19 March 2011 - 11:36 AM
Thats the problem it doesnt diplay anything when the code is ran...anything obvious??
#6
Posted 19 March 2011 - 11:40 AM
Nevermind wrong thread...sorry
Edited by yourmom615, 20 March 2011 - 12:17 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









