Help me in solving LBJ201A problem

My issue

import java.util.*;
class Codechef{
public static void main(String args[]){
Scanner read = new Scanner(System.in);
int t = read.nextInt();
for(int i=0; i<t; i++){
int a=read.nextInt();
int c=read.nextInt();
int b=(a+c)/2;
if(b instanceof Integer){
System.out.println(b);
}
else{
System.out.println(-1);
}

    }
}

}

My code

import java.util.*;
class Codechef{
    public static void main(String args[]){
        Scanner read = new Scanner(System.in);
        int t = read.nextInt();
        for(int i=0; i<t; i++){
            int a=read.nextInt();
            int c=read.nextInt();
            int b=(a+c)/2;
            if(b instanceof Integer){
                System.out.println(b);
            }
            else{
                System.out.println(-1);
            }
            
        }
    }
}

Learning course: Java for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone

@raviya
The logic is is both A and C are odd or even then u will get valid average as (A+C)/2 .
but for else cases u will get -1;