下面的函数哪里错误?

class   Demo

 public   static      int    getMax   (int a   int b)

 {

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 /*

 if   (a==b)

return   ture;

  else

 return  false;

  

 

 

 

   

 

 

 

 */

 

 

 

 return(a==b)?ture:false;

 

 

 

 

 

 

 

 

   


                

 

           

  }

  


qq_丘比特_0
浏览 1270回答 2
2回答

一曝十寒

1、函数入口两个参数中间没有逗号分隔2、return类型与声明int类型冲突 

woshiajuana

public   static      int    getMax   (int a   int b):你声明的getMax函数的返回值是int类型   然后你返回的return(a==b)?ture:false;是布尔类型,所以错误
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java