Skip to content

Instantly share code, notes, and snippets.

@SH2282000
Created October 16, 2020 18:37
Show Gist options
  • Save SH2282000/b5dcb5406909c29ccf716293e114a99f to your computer and use it in GitHub Desktop.
Save SH2282000/b5dcb5406909c29ccf716293e114a99f to your computer and use it in GitHub Desktop.
this is my first try in Java
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