class Fu{
boolean show(char a)
{
System.out.println(a);
return true;
}
}
public class Demo extends Fu
{
public static void main(String[] args)
{
int i=0;
Fu f = new Demo();
Demo d = new Demo();
for(f.show('A');f.show('B')&&(i<2);f.show('C')) //因为逻辑运算符&&,具有短路功能,所以只要有一项不符合要求,即从当前判断条件中断,右面的判断条件不在执行
//for(int x=0;x<5;x++)
{
i++;
d.show('D');
}
}
boolean show(char a)
{
System.out.println(a);
return false;
}
}