-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathValidation_checking.java
More file actions
37 lines (33 loc) · 904 Bytes
/
Validation_checking.java
File metadata and controls
37 lines (33 loc) · 904 Bytes
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
package scope_operator_validation;
public class Validation_checking
{
int s;
Stack_Class st = new Stack_Class(s);
public void validation(String exp)
{
for(int i = 0; i<exp.length(); i++)
{
char temp = exp.charAt(i);
if(temp == '(' || temp == ')' || temp == '{' || temp == '}' || temp == '[' || temp == ']')
{
if(temp == '(' || temp == '{' || temp == '[')
{
st.push(temp); //append oppening operator to the stack
}
else //closing
{
if(st.is_empty())
{
System.out.println("Invalid 1");
}
// do it on monday..
}
}
else
{
i++;
}
}
}
//fix this
}