-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprintln_.java
26 lines (25 loc) · 1.02 KB
/
println_.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
public class println_
{
public static void main(String[] args)
{
int a=10,b=20;
System.out.println(a+b);
System.out.println("the answer "+a+b);//string gibi degerleri yan yana yazdırıyor
System.out.println("the answer "+(a+b));//parantez içinin işlemğini yapıp yazdırıyor
System.out.println("the aswer "+a*b);// * + dan öncelikli --> ez cümle işlem önceliğine vardır
//! System.out.println("the answer "+a-b); hata verir çünkü - ve + işlem önceliği yok. Soldan yazdırmaya baslar string yazar a'yı ekleyecek ama - ifdesini tanımaz.
System.out.println("the answer "+(a-b));
System.out.println("the answer "+a/b);//tam bolme
System.out.println("the answer "+(float)a/b);//ondaklıklı bolme
System.out.println("the anwer "+(float)(a/b));//sonucu float yaptı, float bolmedi :))
}
}
/* output
* the aswer 1020
* the aswer 30
* the answer 200
* the aswer -10
* the aswer 0
* the aswer 0.5
* the answer 0.0
*/