Just another WordPress.com site

pastikan anda memiliki importnya dalam setiap pemrograman java

import java.io.*;
import java.util.*;

public class stack{
Stack stack;
String str;
int num, n;
public static void main(String[] args){
stack q = new stack();
}
public stack(){
try{
stack = new Stack();
InputStreamReader ir = new InputStreamReader(System.in);
BufferedReader bf = new BufferedReader(ir);
System.out.println(“===============”);
System.out.println(“===============”);
System.out.println(“+++++Stack+++++”);
System.out.println(“——In——-“);
System.out.println(“+++++Java++++++”);
System.out.println(“===============”);
System.out.println(“===============”);
System.out.println();
System.out.print(“masukkan array nya : “);
str = bf.readLine();
num = Integer.parseInt(str);
for(int i = 1; i <= num; i++){
System.out.print("masukkan angka array : ");
str = bf.readLine();
n = Integer.parseInt(str);
stack.push(n);
}
}
catch(IOException e){}
System.out.print("Hasil Tumpukan nya adalah : ");
while (!stack.empty()){
System.out.print(stack.pop() + " ");
}
}
}

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 )

Gambar Twitter

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

Foto Facebook

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

Foto Google+

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

Connecting to %s

Awan Tag

%d blogger menyukai ini: