-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMain.java
More file actions
42 lines (32 loc) · 1.17 KB
/
Main.java
File metadata and controls
42 lines (32 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.internshala.javaapp;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//implicit conversion
// int radi = 300;
// long newradi = radi;
// System.out.println(newradi);
// //explicit conversion
// double diameter = 3.40d;
// int newdiameter = (int) diameter;
// System.out.println(newdiameter);
String name ;
int population ;
float popdensity;
double GDP;
char currency;
Scanner scanner = new Scanner(System.in);
System.out.println("enter name");
name = scanner.nextLine(); //nextLine to print the complete line or in next it only shows the first word
System.out.println("enter population");
population = scanner.nextInt();
scanner.close(); //for no memmory loss
currency = scanner.next().charAt(0); //h
System.out.println("enter currency");
System.out.println("your population is "+population);
System.out.println("your name is "+name);
System.out.println("your currency is "+currency);
// int result = 8 % 2;
// System.out.println(result);
}
}