比如一个类 a 他 api里有 setcolor 和 setbook 两个方法
我 A a = new A();
然后我 a.setcolor 是可以的把
如果我要book 我就是 a.setbook
但是这里怎么有这么多set啊
怎么能连续set
Dialog dialog = new AlertDialog.Builder(MyDialogDemo.this)
.setTitle("ȷ��ɾ��") // ��������
.setMessage("��ȷ��Ҫɾ�������Ϣ��") // ��ʾ�Ի����е�����
.setIcon(R.drawable.pic_m) // ����LOGO
.setPositiveButton("ɾ��", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).setNeutralButton("�鿴����", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).setNegativeButton("ȡ��", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).create(); // ������һ��Ի-------------------------------------------------
我 A a = new A();
然后我 a.setcolor 是可以的把
如果我要book 我就是 a.setbook
但是这里怎么有这么多set啊
怎么能连续set
Dialog dialog = new AlertDialog.Builder(MyDialogDemo.this)
.setTitle("ȷ��ɾ��") // ��������
.setMessage("��ȷ��Ҫɾ�������Ϣ��") // ��ʾ�Ի����е�����
.setIcon(R.drawable.pic_m) // ����LOGO
.setPositiveButton("ɾ��", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).setNeutralButton("�鿴����", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).setNegativeButton("ȡ��", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).create(); // ������һ��Ի-------------------------------------------------
public class Student{
String name;
boolean sex;
public Student setName(String name){
this.name = name;
return this;
}
public Student setSex(boolean sex){
this.sex = sex;
return this;
}
public static void main(String args[]){
Student s = new Student();
s.setName("name").setSex(true);
}
}
懂没?