Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Forums
Register
Login
Java
»
Beginning Java
Which different between these two methods please?
André Asantos
,
Ranch Hand
Jun 14, 2010 02:15:03
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Which different between these two methods please?
double somarValores(int a, int b){//um int cabe num double return a + b; } public Object soma (int valor1, int valor2){//faz a mesma coisa do método acima return (valor1 & valor2); } public static void main(String[] args) { System.out.println("O resultado da soma é " + new CriacaoMetodo().soma(2, 2)); }
Christophe Verré
,
Sheriff
staff
Jun 14, 2010 02:20:37
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
somarValores adds two numbers, like 1+2=3. soma performs a binary AND, like 0110 & 1100 = 0100 (see
this
).
Rob Spoor
,
Sheriff
staff
Jun 14, 2010 05:39:41
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
These are definitely not the same. For example, 1 + 1 == 2 while 1 & 1 == 1.
marc weber
,
Sheriff
staff
Jun 14, 2010 12:38:12
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
...not to mention the return types.
Post by:
autobot
It means our mission is in jeapordy! Quick, read this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
This thread has been viewed 788 times.
Similar Threads
OOP?
Object Initialization
the first code on interface
which are the correct answer
Overloading across classes
More...
All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:06:27
.