Class String dan Char

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package javaapplication38;

/**
*
* @author ANGGA
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here

// char
System.out.println(“Apakah ‘a’ huruf : “+Character.isLetter(‘a’));
System.out.println(“Apakah ‘2’ huruf : “+Character.isLetter(2));

System.out.println(“Apakah ‘a’ angka : “+Character.isDigit(‘a’));
System.out.println(“Apakah ‘2’ angka : “+Character.isDigit(‘2′));

System.out.println(“Apakah \’ \’ spasi : “+Character.isWhitespace(‘ ‘));

System.out.println(“Apakah ‘a’ huruf besar : “+Character.isUpperCase(‘a’));
System.out.println(“Apakah ‘a’ huruf kecil : “+Character.isLowerCase(‘a’));

System.out.println(“Apakah ‘A’ huruf besar : “+Character.isUpperCase(‘A’));
System.out.println(“Apakah ‘A’ huruf kecil : “+Character.isLowerCase(‘A’));

System.out.println(“‘a’ ganti ke huruf besar: “+Character.toUpperCase(‘a’));
System.out.println(“‘A’ ganti ke huruf kecil: “+Character.toLowerCase(‘A’));

// string
System.out.println();
String kalimat=”Angga Ari Wijaya”;
String kalimat2=”adalah dark prince”;
System.out.println(“Panjang kalimat ‘Angga Ari Wijaya’ : “+kalimat.length());
System.out.println(“Gabungan kalimat : “+kalimat.concat(” “+kalimat2));
System.out.println(“Ganti Huruf Kecil : “+kalimat.toLowerCase());
System.out.println(“Ganti Huruf Kecil : “+kalimat.toUpperCase());
}

}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s