Some notes on writing a Java software program (pt9)
Subscribe: Apple Podcasts | Google Podcasts | Spotify | RSS | More
Only boolean and Boolean expressions can be used in control flow statements and as the first operand of the conditional operator ? :.An integer or floating-point expression x can be converted to a boolean value, following the C language convention that any nonzero value is true, by the expression x!=0.An object reference obj can be converted to a boolean value, following the C language convention that any reference other than null is true, by the expression obj!=null.(Early-plugs insertion point. A few seconds of silence in audiovisual.)A boolean value can be converted to a String by string conversion. A boolean value may be cast to type boolean, Boolean, or Object. No other casts on type boolean are allowed.There are four kinds of reference types: class types, interface types, type variables, and array types.An object is a class instance or an array.The reference values (often just references) are pointers to these objects, and a special null reference, which refers to no object.A class instance is explicitly created by a class instance creation expression.An array is explicitly created by an array creation expression.Other expressions may implicitly create a class instance or an array.The operators on references to objects are field access, using either a qualified name or a field access expression; method invocation; the cast operator; the string concatenation operator + , which, when given a String operand and a reference, will convert the reference to a String by invoking the toString method of the referenced object (using “null” if either the reference or the result of toString is a null reference), and then will produce a newly created String that is the concatenation of the two strings; the instanceof operator; the reference equality operators == and !=; the conditional operator ? :.There may be many references to the same Java object. Most objects have state, stored in the fields of objects that are instances of classes or in the variables that are the components of an array object. If two variables contain references to the same object, the state of the object can be modified using one variable’s reference to the object, and then the altered state can be observed through the reference in the other variable.Each Java object is associated with a monitor, which is used by synchronized methods and the synchronized statement to provide control over concurrent access to state by multiple threads.The class Object is a superclass of all other classes.
You can invest in my startup company with as little as US$100, for supporting advancing AI, robotics, biotech, and nuclear-fusion powered outer space tech. Visit Robocentric.com/Investors to invest in my startup.
My books on advancing AI, robotics, biotech, and nuclear-fusion powered outer space tech are available at Robocentric.com/Checkout, Amazon, Apple Books, Spotify, Google Play Store, and other online audiobook retailers.
I am Allen Young; I’m an Asian-American man who focuses on advancing AI, robotics, human longevity biotech, and nuclear-fusion powered outer space tech.