I have a while loop and I want to call the variable multiple times is it possible?

An example of this would be i = 0; while(i < 3) { Scanner scan = new Scanner(); String variableIWantToCallLater = scan.nextLine(); } User enters macaroni the first time sausage the second time and …

How to allow out of bounds index in Java

I try to make the program so that the user can give input of the interger of the Month (e.g when user inputs number 4, The output should be April) and it will keep asking so long the user inputs a …

How to Find Index of a Duplicate in An Array (Java)

For this programming assignment, we are supposed to find the index of a duplicate in this array for one row of a sudoku puzzle. I have this method, static boolean equals(int[] a, int[] a2): boolean …

Rockpapergame with rounds and counter variables – java

I am creating a rock paper project which has the following requirement: Continually plays rounds of rock, paper, scissors until one of the players wins three rounds. At that point, the program …

java: loop with switch only works sometimes

I’m really scratching my heard on this one. I’m new at java, and I’m having the strangest thing happen. It’s homework and I’m taking it one step at a time. My issue is the loop just keeps going and …

appending arguments to a String

I need to write a simple Java program so as to step through a given string (given from args[]), and receive a println once a certain character (e.g. ‘^’) is encountered. However, I cannot find why I …

Basic Java Hangman

I am just starting to learn Java as my first programming language. In class we were assigned to make a basic Hangman game with the use of a while and for loops. What I have so far When the user inputs …