JAVA VS YOU- Rock Paper Scissor Game Challenge! #java #shorts #gamedevelopment #coding

preview_player
Показать описание
🎮 Rock Paper Scissors Game in Java – Full Code & Walkthrough! 💻

Welcome to my Java game development tutorial where we bring the classic Rock, Paper, Scissors game to life using Java! 🪨📄✂️

In this video, you'll learn: ✅ How to build the game logic in Java
✅ Taking user input and generating computer choices
✅ Using conditional statements to determine the winner
✅ Adding replay functionality and clean output formatting

Whether you're a beginner in Java or just brushing up your coding skills, this is a fun and easy project to get hands-on with Java basics.

💡 No prior game dev experience needed!
🔔 Don’t forget to like, subscribe, and turn on notifications for more Java projects and programming tutorials!

Code in Pinned Comment--
Рекомендации по теме
Комментарии
Автор

import java.util.Random;
import java.util.Scanner;

class RandomNumber {
public static void main(String[] args) {
Scanner s= new Scanner(System.in);
int user = s.nextInt();
String userchoice = "";
if(user>10 && user<30)
userchoice="rock";
else if(user>30 && user<60)
userchoice="paper";
else if(user>60 && user<90)
userchoice="secissor";
else {
System.out.println("wrong input");
return;
}

Random r=new Random();
String Compchoice = "";
int computer = r.nextInt(100);
if(computer>10 && computer<30)
Compchoice="rock";
else if(computer>30 && computer<60)
Compchoice="paper";
else if(computer>60 && computer<90)
Compchoice="secissor";
else {
System.out.println("ivalid input");
return;
}
System.out.println("computer number "+computer+ " computer choice "+Compchoice);
System.out.println("user number "+user+ " user choice "+userchoice);


if
{
System.out.println("its tie");
}
else if(
(userchoice.equals("rock") && Compchoice.equals("paper")) ||
&& Compchoice.equals("rock")) ||
(userchoice.equals("paper") &&
)
{
System.out.println("computer wins");
}
else{
System.out.println("user wins");
}
}
}

Horridnick
welcome to shbcf.ru