tag:blogger.com,1999:blog-4816987417907886548.post705761258514094065..comments2023-07-02T21:34:46.552+06:00Comments on Java Error Messages and Solutions: attempting to use incompatible return typeShamsuddin Ahammadhttp://www.blogger.com/profile/09496582775045632128noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-4816987417907886548.post-25602026312746739032021-01-03T20:48:56.845+06:002021-01-03T20:48:56.845+06:00public static void convertToWave(int arr[], int n... public static void convertToWave(int arr[], int n){<br /> <br /> // Your code here<br /> <br /> <br /> int temp;<br /> for(int i=0;i<n;i++)<br /> {<br /> if(arr[i] < arr[i + 1])<br /> {<br /> arr[i] = arr[i + 1];<br /> arr[i + 1] = temp;<br /> temp = arr[i];<br /> }<br /> }<br /> return arr;<br /> <br /> }<br /> <br />}<br />this show incompatible return type <br />How tp remove such error ?Gaurav Kumarhttps://www.blogger.com/profile/10592049370166884869noreply@blogger.comtag:blogger.com,1999:blog-4816987417907886548.post-54418092168757109262011-07-11T13:16:21.355+06:002011-07-11T13:16:21.355+06:00question: did you mean to round the sum of only th...question: did you mean to round the sum of only the doubles, or also to get the result of the sum-method in long form to be rounded?<br /><br />the correct code could just as well have been:<br /><br />[Code]<br />public class Subclass extends SuperClass{<br />public long sum(long a, long b){<br /> return (a+b);<br />}<br />}<br />[/Code]<br /><br />You may also want to add the label overloading, since that is what you are explaining here.Hansnoreply@blogger.com