4 years ago

Flip a Coin

Made with Java

https://code.dcoder.tech/files/code/5f777d641538d91990533f48/flip-a-coin

Description in Article Explaining how The Program Works


Hello, i am an super lazy developer if you don't know me, i used to make scratch programs, but i quit scratch and started to do actual coding. one programming language that catched my eyes was java, java is super powerful and really cool, i highly recomend it.

Anyways firstly of course we are gonna make the basic stuff which activates the code, here is a tip, at every end of each code, always use a semicolon(;) anyways after doing some stuff i used the main method, which is the method that activates the program. in the main method i used a code to tell people what side is the coin using the following script:


System.out.println("1 is Head, 0 is Picture");

now we want to set up an integer using the int command, and we will use Math.random for the number to be completly random

kinda like this


int random = (int)(Math.random() * 2);


Now we want to print out the result of 1 or 0 by using System.out.println.

Like this:


System.out.println(random);


And there we go! that is how i made my first program in java! thanks for reading, stay thicc, and peace out.



0 comments

Loading...

Next up

cool thing i did with worldedit(my friend was afk so i figured i would do this while he is away)

cursed

rip my profile

another build

i like worldedit

The Ultimate AMONG SUS is Now Available for Play!! Thanks for your patience.

See this game's store on ladder software:https://discord.gg/g6GXsfxdCn Mobile controls coming tommorow

really easy

(stolen from discord)

relatable

relatable