public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Input a number: ");
int a = in.nextInt();
System.out.print("Input a number: ");
int b= in.nextInt();
System.out.println("Введите действия с числами\n 1.сложить\n 2.вычесть \n 3.Умножить \n 4.Поделить");
int t=in.nextInt();
switch (t) {
case 1:
System.out.print(a+b);
break;
case 2:
System.out.print(a-b);
break;
case 3:
System.out.print(a*b);
break;
case 4:
System.out.print(a/b);
break;
}
}
Set<Road> roads = new HashSet<Road>();
Road getRoad(c1, c2){
for(Road r:roads) if((r.city1.equals(c1) && r.city2.equals(c2)) || (r.city2.equals(c1) && r.city1.equals(c2))) return r;
Road r = new Road(c1, c2);
roads.add(r);
return r;
}
public void serialWrite(char c){
//writes the entire string at once.
comPort.setComPortTimeouts(SerialPort.TIMEOUT_SCANNER, 0, 0);
try{Thread.sleep(5);} catch(Exception e){}
PrintWriter pout = new PrintWriter(comPort.getOutputStream());pout.write(c);
pout.flush();
}
public void serialWrite(char c){
byte[] b = {(byte)c};
comPort.writeBytes(b, b.length);
}
System.out.println(a < b ? "True." : "False");
принимает запросы только со своего адреса