Skip to content

Instantly share code, notes, and snippets.

@mokomokohitsuzi
Created November 25, 2016 14:00
Show Gist options
  • Save mokomokohitsuzi/80979bbb1106e8b835b7df89cbcf28bc to your computer and use it in GitHub Desktop.
Save mokomokohitsuzi/80979bbb1106e8b835b7df89cbcf28bc to your computer and use it in GitHub Desktop.
新・明解Java入門 演習5-2
import java.util.Scanner;
public class En05_02 {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
System.out.println("変数xはfloat型で、変数yはdouble型です。");
System.out.print("x :");
float x = stdIn.nextFloat();
System.out.print("y :");
double y = stdIn.nextDouble();
//float型は約5~7桁
System.out.println("x = " + x);
//double型は約15桁
System.out.println("y = " + y);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment