output is expected to be in true or false.
but when return a boolean or a string , it show s incompatible data type
Incompatible data type
Please share the link to your code
import java.util.*; public class Main { public static void main(String args[]) { // Your Code Here Scanner sc=new Scanner(System.in) ; System.out.print(“Enter number of inputs”); int n=sc.nextInt(); int[] arr=new int[n]; System.out.print(“Enter values”); for(int i=0;i<n;i++){ arr[i]=sc.nextInt(); } boolean ch=check(n,arr); String che; if(ch){ che=“true”; }else{ che=“false”; } System.out.print(che); } public static boolean check(int n,int[] arr){ if(n==0){ return true; } int l=n-1; if(arr[l]>arr[l-1]){ l–; check(n-1,arr); }else{ return false; } return false; } }
how to share link of code
paste your code into codingblocks online ide and save the page and share the link over here
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.