Tuesday, December 25, 2018

Belajar Tipe Data Pada Java Dan Dibuktikan Melalui program


Hello kembali di bloger saya,saya akan men sharing materi tipe data pada java.
apa aja sih ?

sebelumnya anda harus sudah menginstal text editornya
di link dibawah ini

ini data pada java ada apa aja ?
1.integer
2.byte
3.short
4.long
5.double
6.float
7.char
8.bolean




package com.android;

public class
tipe_data {

    
public static void main(String[] args){
         System.
out.println("======INTEGER========");
         int
i = 2147483647;
        
System.out.println("Nilai Integer  = " +(i+1));
        
System.out.println("NIlai Max Integer = " + Integer.MAX_VALUE);
        
System.out.println("NIlai Min Integer = " + Integer.MIN_VALUE);
        
System.out.println("Besar Integer = " + Integer.BYTES + "bytes");
        
System.out.println("Besar Integer = " + Integer.SIZE + "bit");

        
System.out.println("======Byte========");
         byte
b = 10;
        
System.out.println("Nilai Integer  = " +b);
        
System.out.println("NIlai Max Byte = " + Byte.MAX_VALUE);
        
System.out.println("NIlai Min Byte = " + Byte.MIN_VALUE);
        
System.out.println("Besar Byte = " + Byte.BYTES + "bytes");
        
System.out.println("Besar Byte = " + Byte.SIZE + "bit");

        
System.out.println("======SHORT========");
         short
shrt = 8;
        
System.out.println("Nilai Integer  = " +shrt);
        
System.out.println("NIlai Max Short = " + Short.MAX_VALUE);
        
System.out.println("NIlai Min Short = " + Short.MIN_VALUE);
        
System.out.println("Besar Short = " + Short.BYTES + "bytes");
        
System.out.println("Besar short = " + Short.SIZE + "bit");

        
System.out.println("======LONG========");
         long
l = 30L;
        
System.out.println("Nilai Long  = " +l);
        
System.out.println("NIlai Max Long = " + Long.MAX_VALUE);
        
System.out.println("NIlai Min Long = " + Long.MIN_VALUE);
        
System.out.println("Besar Long = " + Long.BYTES + "bytes");
        
System.out.println("Besar Long = " + Long.SIZE + "bit");

        
System.out.println("======Double========");
         double
d = 20.2d;
        
System.out.println("Nilai Double  = " +d);
         
System.out.println("NIlai Max Double = " + Double.MAX_VALUE);
        
System.out.println("NIlai Min Double = " + Double.MIN_VALUE);
        
System.out.println("Besar Double = " + Double.BYTES + "bytes");
        
System.out.println("Besar Double = " + Double.SIZE + "bit");

        
System.out.println("======Float========");
         float
f = -20.5f;
        
System.out.println("Nilai Float  = " + f);
        
System.out.println("NIlai Max Float = " + Float.MAX_VALUE);
        
System.out.println("NIlai Min Float = " + Float.MIN_VALUE);
        
System.out.println("Besar Float = " + Float.BYTES + "bytes");
        
System.out.println("Besar Float = " + Float.SIZE + "bit");
          
//char (koma,bilangan real) Berdasarkan Ascii
        
System.out.println("======Char========");
         char
c = 'p';
        
System.out.println("Nilai Char  = " + c);
        
System.out.println("NIlai Max Char = " + Character.MAX_VALUE);
        
System.out.println("NIlai Min Char = " + Character.MIN_VALUE);
         
System.out.println("Besar Character = " + Character.BYTES + "bytes");
        
System.out.println("Besar Character = " + Character.SIZE + "bit");

        
System.out.println("======Boelean========");
         boolean
val = true;
        
System.out.println("Nilai Bolean  = " + val);
        
System.out.println("NIlai Boelean  = " + Boolean.TRUE);
        
System.out.println("NIlai Boelean = " + Boolean.FALSE);


    
}
}






Hasil program di atas akan menghasilkan di ketahuai Nilai max,Nilai Min semua tipe data pada java.... yaps bisa di coba yoww…





======INTEGER========
Nilai Integer  = -2147483648
NIlai Max Integer = 2147483647
NIlai Min Integer = -2147483648
Besar Integer = 4bytes
Besar Integer = 32bit
======Byte========
Nilai Integer  = 10
NIlai Max Byte = 127
NIlai Min Byte = -128
Besar Byte = 1bytes
Besar Byte = 8bit
======SHORT========
Nilai Integer  = 8
NIlai Max Short = 32767
NIlai Min Short = -32768
Besar Short = 2bytes
Besar short = 16bit
======LONG========
Nilai Long  = 30
NIlai Max Long = 9223372036854775807
NIlai Min Long = -9223372036854775808
Besar Long = 8bytes
Besar Long = 64bit
======Double========
Nilai Double  = 20.2
NIlai Max Double = 1.7976931348623157E308
NIlai Min Double = 4.9E-324
Besar Double = 8bytes
Besar Double = 64bit
======Float========
Nilai Float  = -20.5
NIlai Max Float = 3.4028235E38
NIlai Min Float = 1.4E-45
Besar Float = 4bytes
Besar Float = 32bit
======Char========
Nilai Char  = p
NIlai Max Char = ￿
NIlai Min Char = 
Besar Character = 2bytes
Besar Character = 16bit
======Boelean========
Nilai Bolean  = true
NIlai Boelean  = true
NIlai Boelean = false

Process finished with exit code 0


No comments:

Post a Comment

test

import 'dart:async' ; import 'package:flutter/material.dart' ; class MyBeginner extends StatefulWidget { var...