-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabdulbari.java
More file actions
163 lines (155 loc) · 3.18 KB
/
abdulbari.java
File metadata and controls
163 lines (155 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
public class abdulbari {
public static void main(String[] args)throws Exception{
stack s=new stack();
for(int i=1;i<=5;i++)s.push(i);
for(int i=1;i<=5;i++)s.pop();
System.out.println(s.peek());
}
}
class stackUnderFlow extends Exception{
stack s;
public stackUnderFlow(stack s){
this.s=s;
if(s.getIndx()<0)System.out.println(this);
}
public String toString() {
return "sam bolta stack underflow";
}
}
class stack extends Exception{
int arr[]= new int[5];
private int indx;
public stack(){
indx=-1;
}
public void push(int element){
arr[++indx]=element;
}
public int pop(){
return arr[indx--];
}
public int peek()throws Exception{
if(indx==-1)throw new stackUnderFlow(this);
return arr[indx];
}
public int getIndx(){
return indx;
}
public int stackSize(){
return arr.length;
}
}
class Student{
String roll;
private static int count=0;
public Student(){
roll="UNIV-"+"2024-"+(++count);
}
}
class Demo{
static boolean check=true;
static Demo d=null;//1234GF
private Demo(){}
public static Demo method(){
if(d==null)d=new Demo();
return d;
}
}
class honda{
static int price=10;
int a=10;
}
interface stupidface{
int X=10;
void meth();
static void hello(){
System.out.println("hello");
}
}
interface subFace extends stupidface{
// System.out.println();
static void print(){
System.out.println();
}
}
interface xyz{
// private final static int marks=10;
private void meth3(){
System.out.println("hello");
}
default void getMeth3(){
meth3();
}
}
class abc implements xyz{
void display(){
getMeth3();
}
}
abstract class Member implements subFace{
abstract public void callback();
}
class Store{
Member m[]=new Member[2];
int count=0;
void register(Member me){
m[count++]=me;
}
void invite(){
for(Member x:m){
x.callback();
}
}
}
class Customer extends Member{
String name;
public Customer(String name){
this.name=name;
}
public void meth(){
System.out.println();
}
public void callback(){
if(Math.random()>0.5)System.out.println("ill come");
else System.out.println("i won't");
}
}
class Account{
int accNm;
int balance;
String name;
public Account(int accNm,int balance,String name){
this.accNm=accNm;
this.balance=balance;
this.name=name;
}
public int withdraw(int amount){
balance-=amount;
return amount;
}
}
class SavingsAccount extends Account{
public SavingsAccount(int accN,int balance,String name){
super(accN, balance, name);
}
public int withdraw(int amount){
System.out.println("111");
balance-=amount;
return amount;
}
}
class A{
public A(){
System.out.println("a");
}
}
class B extends A{
public B(){
System.out.println("b");
}
}
class C extends B{
public C(){
System.out.println("c");
}
}