How i print a switch b = c??? I need a hint, tk you!!!
package com.codegym.task.task19.task1914;
/*
Problem solving
*/
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
public class Solution {
public static TestString testString = new TestString();
public static void main(String[] args) {
PrintStream print = System.out;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
PrintStream printStream = new PrintStream(byteArrayOutputStream);
System.setOut(printStream);
testString.printSomething();
String [] abc = byteArrayOutputStream.toString().split(" ");
int a = Integer.parseInt(abc[0]);
int b = Integer.parseInt(abc[2]);
int c = 0;
switch (abc[1]){
case "+":
c=a+b;
break;
case "-":
c=a-b;
break;
case "*":
c=a*b;
break;
}
abc[4]=String.valueOf(c);//value of missing result
System.setOut(print);
System.out.println();// how i print the result, a switch b = c???
}
public static class TestString {
public void printSomething() {
System.out.println("3 + 6 = ");
}
}
}