Ekspresi | Belajar HTML dan PHP | Sunda | Kontak | Gmail | Uang Adsense
Kemahasiswaan Kilas Santai
PMB Online STMIK Jabar 2021
STMIK JABAR
LP3I Tasikmalaya
STAI Al-Falah
Pengobatan Ruqyah
Belajar Pemrograman PHP, MySQL, Framework CI, Domain, Hosting, CMS Wordpress, Framework Laravel. Yang Penting ada menu DAFTAR ISI
Inkubator | Daftar Isi | Bisnis Bitcoin | Tools Penting | PrivacyPolicy | Inggris Arab

Monday, October 25, 2021

Java 5

Java 4: Review

Java 5

Array

File name: Java4

/*

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */

package java4;

/**

 *

 * @author DELL

 */

public class Java4 {

 

    /**

     * @param args the command line arguments

     */

    public static void main(String[] args) {

        // TODO code application logic here

        String[] nama = new String[6];

       

        nama[0] = "Caca";

        nama[1] = "Cece";

        nama[2] = "Cici";

        nama[3] = "Coco";

        nama[4] = "Cucu";

        nama[5] = "Rois";

 

// mengambil data array

System.out.println(nama[4]);

    }

   

}

 

//https://www.petanikode.com/java-array/

 

#####

File name: Java4A

/*

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */

package java4;

import java.util.Scanner;

/**

 *

 * @author DELL

 */

public class Java4A {

    public static void main(String[] args) {

 

        // membuat array buah-buahan

        String[] buah = new String[5];

 

        // membuat scanner

        Scanner scan = new Scanner(System.in);

 

        // mengisi data ke array

        for( int i = 0; i < buah.length; i++ ){

            System.out.print("Buah ke-" + i + ": ");

            buah[i] = scan.nextLine();

        }

 

        System.out.println("---------------------------");

 

        // menampilkan semua isi array

        for( String b : buah ){

            System.out.println(b);

        }

 

    }

}

 

##

Java4C

/*

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */

package java4;

 

/**

 *

 * @author DELL

 */

public class Java4B {

    public static void main(String[] args) {

    String[] nama = {"Tata", "Tete", "Titi", "Toto", "Tutu", "Rois"};

   

    // mengambil data array

    System.out.println(nama[5]);

}

}

 

##

Java4C

/*

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */

package java4;

 

/**

 *

 * @author DELL

 */

public class Java4C {

     // membuat fungsi ucapSalam()

    static void ucapSalam(){

            System.out.println("Selamat Pagi");

    }

   

    static void ucapSalami(){

        System.out.println("Selamat Siang");

    }

 

    // membuat fungsi main()

    public static void main(String[] args){

        // memanggil/eksekusi fungsi ucapSalam()

        ucapSalam();

        ucapSalami();

    }

   

}

 

//https://www.petanikode.com/java-prosedur-dan-fungsi/

//Sisanya bersambung...

 

 


"Bitcoin and Forex are high risk business. We must join them smartly."
Belajar Bahasa Inggris dan Arab di Telegram dan FB Gratis!
Youtube: Katabah Com: Menuju 1 jt Konten :)

No comments:

Post a Comment