Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class sourceCodeChar {
- public static void main(String[] args) {
- //deklarasi variabel
- char c1;
- char c2;
- //inisialisasi value
- c1 = 88;
- c2 = 42;
- //penggunaan dalam operasi
- char c3 = c1++;
- char c4 = c2++;
- //menampilkan nilainya
- System.out.println(c1);
- System.out.println(c2);
- System.out.println(c3);
- System.out.println(c4);
- //input dari keyboard
- Scanner input = new Scanner(System.in);
- System.out.print("Masukkan sebuah char: " );
- char ch = input.next().charAt(0);
- System.out.println("Masukkan sebuah char: " + ch);
- }
- }
Add Comment
Please, Sign In to add comment