Guest User

Untitled

a guest
Nov 18th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. public boolean isValid() {
  2. boolean check;
  3. int number = 5;
  4.  
  5. if (number > 4){
  6. check = true;
  7. } else {
  8. check = false;
  9. }
  10.  
  11. return check;
  12.  
  13. if(isValid == true) // <-- this is where I'm not sure
  14. //stop and go back to the beginning of the program
  15. else
  16. //continue on with the program
  17.  
  18. if(isValid()) {
  19. // something
  20. } else {
  21. //something else
  22. }
  23.  
  24. public boolean isValid() {
  25. int number = 5;
  26. return number > 4;
  27. }
  28.  
  29. if (isValid()) {
  30. ...
  31. } else {
  32. ...
  33. }
  34.  
  35. if (isValid()) {
  36.  
  37. }else {
  38.  
  39. }
  40.  
  41. boolean tempBoo = isValid();
  42.  
  43. if (tempBoo) {
  44.  
  45. }else {
  46.  
  47. }
  48.  
  49. public boolean isValid() {
  50.  
  51. boolean check = false; // always intialize the local variable
  52. int number = 5;
  53.  
  54. if (number > 4){
  55. check = true;
  56. } else {
  57. check = false;
  58. }
  59.  
  60. return check;
  61.  
  62. }
  63.  
  64.  
  65. if(isValid()){
  66.  
  67. // Do something if its true
  68. }else{
  69.  
  70. // Do something if its false
  71. }
  72.  
  73. if (isValid()) {
  74. // do something when the method returned true
  75. } else {
  76. // do something else when the method returned false
  77. }
  78.  
  79. if(isValid())
  80. {
  81.  
  82. }
  83. else
  84. {
  85. }
  86.  
  87. if(isValid()){
  88. //do something....
  89. }
  90. else
  91. {
  92. //do something....
  93. }
  94.  
  95. public boolean isValid() {
  96. boolean check;
  97. int number = 5;
  98.  
  99. if (number > 4){
  100. check = true;
  101. } else {
  102. check = false;
  103. }
  104.  
  105. return check;
Add Comment
Please, Sign In to add comment