What is the difference between the prefix and postfix forms of the ++ operator?
Java Interview Questions and Answers (part 2)
(Continued from previous question...)
345. What is the difference between the prefix and postfix forms of the ++ operator?
The prefix form performs the increment operation and returns the value of the increment operation. The postfix form returns the current value all of the expression and then performs the increment operation on that value.
(Continued on next question...)
Other Interview Questions
- Which java.util classes and interfaces support event handling?
- Is sizeof a keyword?
- What are wrapper classes?
- Does garbage collection guarantee that a program will not run out of memory?
- What restrictions are placed on the location of a package statement within a source code file?
- Can an object's finalize() method be invoked while it is reachable?
- What is the immediate superclass of the Applet class?
- What is the difference between preemptive scheduling and time slicing?
- Name three Component subclasses that support painting.
- What value does readLine() return when it has reached the end of a file?
- What is the immediate superclass of the Dialog class?
- What is clipping?
- What is a native method?
- Can a for statement loop indefinitely?
- What are order of precedence and associativity, and how are they used?
- When a thread blocks on I/O, what state does it enter?
- To what value is a variable of the String type automatically initialized?
- What is the catch or declare rule for method declarations?
- What is the difference between a MenuItem and a CheckboxMenuItem?
- What is a task's priority and how is it used in scheduling?
- What class is the top of the AWT event hierarchy?
- When a thread is created and started, what is its initial state?
- Can an anonymous class be declared as implementing an interface and extending a class?
- What is the range of the short type?
- What is the range of the char type?
- In which package are most of the AWT events that support the event-delegation model defined?
- What is the immediate superclass of Menu?
- What is the purpose of finalization?
- Which class is the immediate superclass of the MenuComponent class.
- What invokes a thread's run() method?
- What is the difference between the Boolean & operator and the && operator?
- Name three subclasses of the Component class.
- What is the GregorianCalendar class?
- Which Container method is used to cause a container to be laid out and redisplayed?
- What is the purpose of the Runtime class?
- How many times may an object's finalize() method be invoked by the garbage collector?
- What is the purpose of the finally clause of a try-catch-finally statement? garbage collector?
- What is the argument type of a program's main() method?
- Which Java operator is right associative?
- What is the Locale class?
- Can a double value be cast to a byte?
- What is the difference between a break statement and a continue statement?
- What must a class do to implement an interface?
- What method is invoked to cause an object to begin executing as a separate thread?
- Name two subclasses of the TextComponent class.
- What is the advantage of the event-delegation model over the earlier event-inheritance model?
- Which containers may have a MenuBar?
- How are commas used in the initialization and iteration parts of a for statement?
- What is the purpose of the wait(), notify(), and notifyAll() methods?
- What is an abstract method?
- How are Java source code files named?
- What is the relationship between the Canvas class and the Graphics class?
- What are the high-level thread states?
- What value does read() return when it has reached the end of a file?
- Can a Byte object be cast to a double value?
- What is the difference between a static and a non-static inner class?
- What is the difference between the String and StringBuffer classes?
- If a variable is declared as private, where may the variable be accessed?
- What is an object's lock and which objects have locks?
- What is the Dictionary class?
- How are the elements of a BorderLayout organized?
- What is the % operator?
- When can an object reference be cast to an interface reference?
- What is the difference between a Window and a Frame?
- Which class is extended by all other classes?
- Can an object be garbage collected while it is still reachable?
- Is the ternary operator written x : y ? z or x ? y : z ?
- What is the difference between the Font and FontMetrics classes?
- How is rounding performed under integer division?
- What happens when a thread cannot acquire a lock on an object?
- What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
- What classes of exceptions may be caught by a catch clause?
- If a class is declared without any access modifiers, where may the class be accessed?
- What is the SimpleTimeZone class?
- What is the Map interface?
- Does a class inherit the constructors of its superclass?
- For which statements does it make sense to use a label?
- What is the purpose of the System class?
- Which TextComponent method is used to set a TextComponent to the read-only state?
- How are the elements of a CardLayout organized?
- Is &&= a valid Java operator?
- Name the eight primitive Java types.
- Which class should you use to obtain design information about an object?
- What is the relationship between clipping and repainting?
- Is "abc" a primitive value?
- What is the relationship between an event-listener interface and an event-adapter class?
- What restrictions are placed on the values of each case of a switch statement?
- What modifiers may be used with an interface declaration?
- Is a class a subclass of itself?
- What is the highest-level event class of the event-delegation model?
- What event results from the clicking of a button?
- How can a GUI component handle its own events?
- What is the difference between a while statement and a do statement?
- How are the elements of a GridBagLayout organized?
- What advantage do Java's layout managers provide over traditional windowing systems?
- What is the Collection interface?
- What modifiers can be used with a local inner class?
- What is the difference between static and non-static variables?
- What is the difference between the paint() and repaint() methods?
- What is the purpose of the File class?
- Can an exception be rethrown?
- Which Math method is used to calculate the absolute value of a number?
- How does multithreading take place on a computer with a single CPU?
- When does the compiler supply a default constructor for a class?
- When is the finally clause of a try-catch-finally statement executed?
- Which class is the immediate superclass of the Container class?
- If a method is declared as protected, where may the method be accessed?
- How can the Checkbox class be used to create a radio button?
- Which non-Unicode letter characters may be used as the first character of an identifier?
- What restrictions are placed on method overloading?
- What happens when you invoke a thread's interrupt method while it is sleeping or waiting?
- What is casting?
- What is the return type of a program's main() method?
- Name four Container classes.
- What is the difference between a Choice and a List?
- What class of exceptions are generated by the Java run-time system?
- What class allows you to read objects directly from a stream?
- What is the difference between a field variable and a local variable?
- Under what conditions is an object's finalize() method invoked by the garbage collector?
- How are this () and super () used with constructors?
- What is the relationship between a method's throws clause and the exceptions that can be thrown during the method's execution?
- What is the difference between the JDK 1.02 event model and the event-delegation model introduced with JDK 1.1?
- How is it possible for two String objects with identical values not to be equal under the == operator?
- Why are the methods of the Math class static?
- What Checkbox method allows you to tell if a Checkbox is checked?
- What state is a thread in when it is executing?
- What are the legal operands of the instanceof operator?
- How are the elements of a GridLayout organized?
- What an I/O filter?
- If an object is garbage collected, can it become reachable again?
- What is the Set interface?
- What classes of exceptions may be thrown by a throw statement?
- What are E and PI?
- Are true and false keywords?
- What is a void return type?
- What is the purpose of the enableEvents() method?
- What is the difference between the File and RandomAccessFile classes?
- What happens when you add a double value to a String?
- What is your platform's default character encoding?
- Which package is always imported by default?
- What interface must an object implement before it can be written to a stream as an object?
- How are this and super used?
- What is the purpose of garbage collection?
- What is a compilation unit?
- What interface is extended by AWT event listeners?
- What restrictions are placed on method overriding?
- How can a dead thread be restarted?
- What happens if an exception is not caught?
- What is a layout manager?
- Which arithmetic operations can result in the throwing of an ArithmeticException?
- What are three ways in which a thread can enter the waiting state?
- Can an abstract class be final?
- What is the ResourceBundle class?
- What happens if a try-catch-finally statement does not have a catch clause to handle an exception that is thrown within the body of the try statement?
- What is numeric promotion?
- What is the difference between a Scrollbar and a ScrollPane?
- What is the difference between a public and a non-public class?
- To what value is a variable of the boolean type automatically initialized?
- Can try statements be nested?
- What is the difference between the prefix and postfix forms of the ++ operator?
- What is the purpose of a statement block?
- What is a Java package and how is it used?
- What modifiers may be used with a top-level class?
- What are the Object and Class classes used for?
- How does a try statement determine which catch clause should be used to handle an exception?
- Can an unreachable object become reachable again?
- When is an object subject to garbage collection?
- What method must be implemented by all threads?
- What methods are used to get and set the text label displayed by a Button object?
- Which Component subclass is used for drawing and painting?
- What are the two basic ways in which classes that can be run as threads may be defined?
- What are the problems faced by Java programmers who don't use layout managers?
- What is the difference between an if statement and a switch statement?
- Can there be an abstract class with no abstract methods in it?
- Can an Interface be final?
- Can an Interface have an inner class?
- Can we define private and protected modifiers for variables in interfaces?
- What is Externalizable?
- What modifiers are allowed for methods in an Interface?
- What is a local, member and a class variable?
- I made my class Cloneable but I still get 'Can't access protected method clone. Why?
- What are the different identifier states of a Thread?
- What are some alternatives to inheritance?
|