Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This isn't so much a programming question, but a clarification of the assignment.</p> <blockquote> <p>I don't know how to set the code up to read if the player wins or not as I don't have the scores.</p> </blockquote> <p>Well neither do any of us. We don't even know to which game you are referring, so we can't tell you how to find the score.</p> <blockquote> <p>Also I'm having issues getting Java to return two figures as one instead of 1+2 = 3 I need it to return 12. so return 1 + 2 doesn't work.</p> </blockquote> <p>That statement is unclear. What do you mean return two figures as one? Java methods can return either nothing (return type void), a primitive value or an object reference. If you want it to return 2 primitive values, like two integers, then you need to wrap it in an object which contains two integers.</p> <pre><code>class TwoInts { private int first; private int second; public TwoInts(int first, int second) { this.first = first; this.second = second; } public int getFirst() { return first; } public int getSecond() { return second; } } // in your other class class TestTwoInts { TwoInts getInts() { return new TwoInts(1, 2); } } </code></pre> <blockquote> <p>and lastly how do I get Java to print information from other methods?</p> </blockquote> <p><code>System.out.println</code> is accessible from anywhere in any Java program. It doesn't matter from which methods you call it.</p> <blockquote> <p>I have a question where I need to print a line that takes information from 2 other methods I've made.</p> </blockquote> <p>What is the question?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload