Skip to content

Commit eedfb6c

Browse files
author
Replit user
committed
added random color generator using java
1 parent 5afec25 commit eedfb6c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

random_color_generator/color.java

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import java.awt.Color;
2+
import java.util.Random;
3+
4+
public class RandomColorGenerator {
5+
public static void main(String[] args) {
6+
7+
Random random = new Random();
8+
9+
10+
int red = random.nextInt(256);
11+
int green = random.nextInt(256);
12+
int blue = random.nextInt(256);
13+
14+
15+
Color randomColor = new Color(red, green, blue);
16+
17+
18+
System.out.println("Red: " + red);
19+
System.out.println("Green: " + green);
20+
System.out.println("Blue: " + blue);
21+
System.out.println("Random Color: " + randomColor);
22+
23+
24+
}
25+
}

0 commit comments

Comments
 (0)