public class E{public static void main(String[]args){EQ e=new EQ();e.name="Mr.Deng";e.age=29;e.weight=50.5;e.hobby="Designing something that he like";e.jieShao();String b=e.sentPresence();//对象接受返回值System.out.println("That's "+b);System.out.println("哈哈^_^,不用谢我。");}
}
class EQ{String name;int age;double weight;String hobby;//方法类型一:无参无返public void jieShao(){System.out.println("name:"+name+"\n"+"age:"+age+"\n"+"weight:"+weight+"\n"+"hobby:"+hobby);}//方法类型二:无参有返public String sentPresence(){System.out.println("我送了你礼物!Mr.Deng!");return "mac笔记本";//返回了一个值给对象}}