java - Not returning values, from a function with non-void return type -
i read here on so how : in c++ : not returning non-void function undefined behavior. ... analysis requires inspection of entire program, incompatible separate compilation, , not possible in general case ... from made out of several answers on page, difficult, , infact impossible sometimes, check presence of return statement in functions. not returning non-void function left undefined behavior c++ standard. however, heard in java, same thing reported error @ compile time. q. understanding correct ? , how java achieves same ? edit: clear, interested in understanding : if left undefined in c++ standard implementation difficulties related compiler, how java able achieve same. and if not difficult do, shouldn't c++ standard have defined error ? java refusing run programs, if return value. take following (stupid) method public boolean test() { boolean var=true; if(var) return true; } the method return true, java still refuse accept val...