Cari artikel di situs ini

Tanggapi komentar

tanya:boolean

pak, mau nanya.. soalnya udah saya pikirin sendiri tetep ga nemu jawabnya, malah binun cendili... :(

saya bingung di variable boolean "inputvalid".

nilai awal "inputvalid=false",

kemudian di dalam while ==> while(!inputvalid)==> disini kan inputvalid jadi "true",, berarti perulangan terjadi selama kondisi "true". tapi kenapa untuk berhenti nilai inputvalid jadi "true' juga????? mohon pencerahannya.....terimakasih byk atas bantuannya yg sangat bermanfaat.

 

boolean inputvalid = false; int suitKomputer = 0; int suitUser = 0;

.....................

....................

// selama input tidak valid, jalankan perulangan

i while (!inputvalid) {

...................

.....................

if (input.length() > 0)

{ switch (input.charAt(0))

{

case 'j' :

case 'J' :

suitUser = 0;

inputvalid = true; // kita ganti inputvalid agar perulangan selesai break;

Balas

Isi bagian ini tidak akan ditampilkan untuk umum.
  • Tag HTML yang dibolehkan: <p> <br> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <span> <blockquote> <table> <caption> <tbody> <tr> <td> <h1> <h2> <h3> <h4> <h5> <h6> <address> <pre>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <pre>, <c>, <cpp>, <java>. Beside the tag style "<foo>" it is also possible to use "[foo]".

Informasi lebih lanjut tentang opsi format tulisan

Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated.