12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import java.util.Scanner;
-
- class HeiStudent {
- private static void a() {
- System.out.println("Hei student!");
- }
-
- private static void b() {
- String name = "Martin";
- System.out.println("Hello, "+name);
- }
-
- private static void c() {
- //Asks the user what age they are, printing the name back to them
- System.out.println("What's your name?");
- Scanner s = new Scanner(System.in);
- System.out.println("Hello "+s.nextLine());
- }
-
- private static void d() {
- int a = 10;
- int b = 200;
- System.out.println(a+"+"+b+"="+(a+b));
- }
-
- private static void e() {
- Scanner s = new Scanner(System.in);
-
- //Asks the user for two number
- System.out.println("Write a number.");
- int a = s.nextInt();
- System.out.println("Write another number.");
- int b = s.nextInt();
-
- //Tells the user the sum of the numbers they entered
- System.out.println(a+"+"+b+"="+(a+b));
- }
-
- public static void main(String[] args) {
- a();
- b();
- c();
- d();
- e();
- }
- }
|