Created
September 22, 2015 09:30
-
-
Save TopekoX/f0a1cfc037752fff3ea9 to your computer and use it in GitHub Desktop.
Demo Variabel lokal java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DemoVariabelLokal{ | |
// membuat method lokal test | |
void test(){ | |
int umur=0; //mendeklarasikan variabel lokal dengan nama umur dan memasukan nilai 0 ke dalamnya | |
umur = umur + 20; //memasukan nilai umur yang sudah ada ditambah dengan 20 | |
System.out.println("Umur saya : " + umur); | |
} | |
public static void main(String[] args){ | |
DemoVariabelLokal demo = new DemoVariabelLokal(); // instansiasi objek dari kelas DemoVariabelLokal | |
demo.test(); //memanggil method test yang ada di dalam kelas DemoVariabelLokal | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment