• 0

Help me with the output


Question

Can someone help me out..what would the output of this code be........

class Question4 {

private int x, y, z;

public void start() {

int x, y;

setup();

x = y = 10;

modify(x, y);

printout();

}

private void setup() {

x = 100;

y = 200;

z = 300;

}

private void modify(int x, int y) {

z = x + y;

x = z;

y = 2 * z;

}

private void printout() {

System.out.println("x+ x);

System.out.println("y+ y);

System.out.println("z+ z);

}

}

class Q4Main {

public static void main(String[] args) {

Question4 q4;

q4 = new Question4();

q4.start();

}

}

Link to comment
https://www.neowin.net/forum/topic/144698-help-me-with-the-output/
Share on other sites

17 answers to this question

Recommended Posts

  • 0

You are probably confused by now.

Jcreator provides a nice interface for you to write programs. Really, you could do it in notepad, but it is a lot nicer and easier with Jcreator. However, Jcreator itself doesn't compile the programs, you need SDK (Sun development kit) installed for that.

  • 0
  Kestrel said:
I would point out that this is the THIRD question from the original poster; looks like he's just doing his homework here.

I noticed that too, which is why I suggested him getting his own compiler. If he keeps doing it, then he is going to get it from us. I have a feeling that once he realizes how hard programming can be, he is going to quit. Just a feeling though.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.