为了账号安全,请及时绑定邮箱和手机立即绑定
int newAge=--age1; 和int newAge=age1--;有什么区别,他们的运输顺序是怎样的?

正在回答

34 回答

减减放在前面是先减1在赋值
放在后面是先赋值在减1
加加也同理

0 回复 有任何疑惑可以回复我~

--在前,即先自减,在进行其它的运算;在后的--,即先进行运算,在进行自减

我叫荀彧(GouHuo),先举个栗子:

int a=1,b=2 ;

int c ;

c=--a ; //即先进行运算 a=a-1=0 ; 在进行运算 c=a=0;

c=a-- ; //即先进行运算 c=a=1 在进行运算 a=a-1=0

c= ( --a )+b ; //即先进行运算 a=a-1=0 ; 在进行运算 c=a+b=2

c=b+ ( a-- ) ; //即先进行运算 c=b+a=3 ; 在进行运算 a=a-1 =0

++同理


0 回复 有任何疑惑可以回复我~

--在前,即先自减,在进行其它的运算;在后的--,即先进行运算,在进行自减

我叫荀彧(GouHuo),先举个栗子:

int a=1,b=2 ;

int c ;

c=--a ; //即先进行运算 a=a-1=0 ; 在进行运算 c=a=0;

c=a-- ; //即先进行运算 c=a=1 在进行运算 a=a-1=0

c= ( --a )+b ; //即先进行运算 a=a-1=0 ; 在进行运算 c=a+b=2

c=b+ ( a-- ) ; //即先进行运算 c=b+a=3 ; 在进行运算 a=a-1 =0

++同理

0 回复 有任何疑惑可以回复我~

他自减后的年龄是怎么算的呢

0 回复 有任何疑惑可以回复我~

哪位大神可以帮我解释一下,十分感谢

0 回复 有任何疑惑可以回复我~

我不知道这是是什么意思。。。

0 回复 有任何疑惑可以回复我~

package jforex;


import java.util.*;


import com.dukascopy.api.*;


public class Strategy implements IStrategy {

    private IEngine engine;

    private IConsole console;

    private IHistory history;

    private IContext context;

    private IIndicators indicators;

    private IUserInterface userInterface;

    

    public void onStart(IContext context) throws JFException {

        this.engine = context.getEngine();

        this.console = context.getConsole();

        this.history = context.getHistory();

        this.context = context;

        this.indicators = context.getIndicators();

        this.userInterface = context.getUserInterface();

    }


    public void onAccount(IAccount account) throws JFException {

    }


    public void onMessage(IMessage message) throws JFException {

    }


    public void onStop() throws JFException {

    }


    public void onTick(Instrument instrument, ITick tick) throws JFException {

    }

    

    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {

    }

}

哪位大神能解读下这都什么意思····

0 回复 有任何疑惑可以回复我~

package jforex;


import java.util.*;


import com.dukascopy.api.*;


public class Strategy implements IStrategy {

    private IEngine engine;

    private IConsole console;

    private IHistory history;

    private IContext context;

    private IIndicators indicators;

    private IUserInterface userInterface;

    

    public void onStart(IContext context) throws JFException {

        this.engine = context.getEngine();

        this.console = context.getConsole();

        this.history = context.getHistory();

        this.context = context;

        this.indicators = context.getIndicators();

        this.userInterface = context.getUserInterface();

    }


    public void onAccount(IAccount account) throws JFException {

    }


    public void onMessage(IMessage message) throws JFException {

    }


    public void onStop() throws JFException {

    }


    public void onTick(Instrument instrument, ITick tick) throws JFException {

    }

    

    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {

    }

}


0 回复 有任何疑惑可以回复我~

--在前是先自减,再进入运算。--在后,先运算后自减。

0 回复 有任何疑惑可以回复我~

赋值的优先级不是比自减低吗,为什么不会先算自减?

0 回复 有任何疑惑可以回复我~
首页上一页1234下一页尾页

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信