2018.7.28第二题作业答案

//(1)定义如下方法public static String getPropertyGetMethodName(String property);

//(2)该方法的参数为String类型,表示用户给定的成员变量的名字,返回值类型为String类型,返回值为成员变量对应的get方法的名字

//(3)如:用户调用此方法时给定的参数为"name",该方法的返回值为"getName"




public class zuoye01 {

     

    public static void main(String[] args) {

       // TODO Auto-generated method stub

      

           System.out.println(getPropertyGetMethodName("weige"));

    }

    public static String getPropertyGetMethodName(String property) {

       return "get"+property.substring(0, 1).toUpperCase()+property.substring(1);      

    }

 

}

猜你喜欢

转载自www.cnblogs.com/a709898670/p/9382495.html