-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinput.java
47 lines (42 loc) · 1.36 KB
/
input.java
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
43
44
45
46
47
import java.util.Scanner;
public class input
{
public static void main(String args[])
{
int a,b;
float x,y;
double z,t;
char m;
String w;
Scanner ns=new Scanner(System.in);
//todo string ve cahr input'u bir tık farklı dikkat eddelim
//todo Char
System.out.printf("%ncahr m = ");
m=ns.nextLine().charAt(0);
System.out.printf("m = %c%n++m = %c",m,++m);
//todo String
System.out.printf("%nstring w = ");
w=ns.nextLine();
System.out.printf("%nw = %s",w);
//todo int
System.out.printf("%nint a = ");
a=ns.nextInt();
System.out.printf("%nint b = ");
b=ns.nextInt();
System.out.printf("%na + b = %d",a+b);
//todo float
System.out.printf("%nflaot x = ");
x=ns.nextFloat();
System.out.printf("%nflaot y = ");
y=ns.nextFloat();
System.out.printf("%nx + y = %f",x+y);
//todo double
System.out.printf("%ndouble z = ");
z=ns.nextDouble();
System.out.printf("%ndouble t = ");
t=ns.nextDouble();
System.out.printf("%nz + t = %f",z+t);
ns.close();//kapatıyoruz
}
}
//* Scanner bir class bu class'tan bir nesne oluşturuyoruz. Daha sonra bu nesne ile input alma methodlarına ulaşıyoruz:)