Created
October 16, 2020 18:37
-
-
Save SH2282000/b5dcb5406909c29ccf716293e114a99f to your computer and use it in GitHub Desktop.
this is my first try in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ShannaX; | |
import java.text.NumberFormat; | |
import java.util.Arrays; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
try (Scanner scanner = new Scanner(String.valueOf(args))) { | |
System.out.println(Arrays.toString(args)); | |
} | |
//Math class | |
int randNum = (int) (Math.random()*100); | |
//format | |
String result = NumberFormat.getPercentInstance().format(0.1); | |
System.out.println(result); | |
//reading input | |
Scanner scanner = new Scanner(System.in); | |
System.out.print("What's your name : "); | |
String name = scanner.nextLine().trim(); | |
System.out.println("you are " + name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment