+ 1

Hi, what is the problem?

can i write this? static void c(int x , int y) { system.out.println(x*y) } is it wrong at all? or we can edit this public class Program { static void e (int x) { System.out.println(x); } static void h (int y) { System.out.println(y); } public static void main(String[] args) { int sum = 0; e(4); h(3); sum = e(4) + h(3); System.out.println(sum); } }

3rd Nov 2016, 5:00 PM
ehsan shahbazi
ehsan shahbazi - avatar
2 Réponses
+ 2
//in your class called program,when u call with e(4) and h(3), they'll print as: 4 5 //but when u try to print sum it will print "0" because e(4) and h(3) will return 0 cuz the return type is void
3rd Nov 2016, 5:23 PM
Diwas
Diwas - avatar
+ 1
ty and about the question number one?
3rd Nov 2016, 6:54 PM
ehsan shahbazi
ehsan shahbazi - avatar