class A{
int data=50;//instance variable
static int m=100;//static variable
void method(){
int n=90;//local variable
}
}//end of class
Javada ma’lumot turlari (data types)
Javada ma’lumotlar turlari 2 ta
1. Soda(primitive )
2. Soda bo’lmagan (non primitive)
public class Varibles {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(Character.SIZE / 8 + " byte");
System.out.println(Byte.SIZE / 8 + " byte");
System.out.println(Short.SIZE / 8 + " byte");
System.out.println(Integer.SIZE / 8 + " byte");
System.out.println(Long.SIZE / 8 + " byte");
System.out.println(Float.SIZE / 8 + " byte");
System.out.println(Double.SIZE / 8 + " byte");
}
}
Java dasturlash tilida eng ko’p ishlatilardigan operatorlar (solishtirish operatorlari, mantiqiy operatorlar, o‘zlashtirish operatori)
Solishtirish operatori
Ikki operatorni bir-biri bilan solishtirishda ishlatialdi. Odatda, solishtirish operatorlar, shart berish operatori(if) va sikl(while for) ammalari bilan ishlatialdi.
Bu aperatrlar ikki xil natija qaytarishi mumkin true yokiy false
Java dasturlash tilida quyidagi solishtirish operatorlari mavjud:
== -> teng
!= -> teng emas
> -> katta
< -> kichik
>= -> katta yokiy teng
<= -> kichik yokiy teng
public class CompareOperators {
public static void main(String[] args) {
int a = 3;
int b = 6;
Do'stlaringiz bilan baham: |