Good one dude. ++ automatically involves casting while "+" does not , remembered this concept while I prepared for SCJP , some how didn't recall it quickly :)
State pattern falls under the category of Behavioral patterns. State design pattern comes in picture when a system’s behavior is depends on its own state or some other resource’s state. If an implementation is depends on the states, we end up with snarl of conditional statement every where in code. A very neat approach to deal with such situation is to separate out every state’s behavior and use them where ever they are applicable. The state pattern allows an object to alter its behavior when is internal state changes . The object is appeared to change its class. State pattern is a way to implement the same. Class Diagram : As above class diagram shows, System class holds state instance. As state of system changes , all handle request delegated to respective State’s concrete implementation. Example : Have an example of Vending machine. Vending machine has following states No Coin Inserted Coin Inserted Dispensing Empty Following diagram explain behavior...
Addition to Eclipse command framework series, this post explains use of property tester to control command’s enable/visible properties. In earlier post we have tried declarative way to achieve same thing but property tester gives us more control. Property tester is associated with, tester class which implements PropertyTester.java, a namespace and set of property which it supports. We can refer this property tester using its namespace + a property name. It gives you call back to test() method with property name as parameter inside property tester class. We can configure property tester for type of input parameter. Here is sample declaration of property tester extension point < extension point ="org.eclipse.core.expressions.propertyTesters" > < propertyTester class ="com.example.advance.cmd.EditorTester" id ="com.example.advance.cmd.propertyTester1" namespace ="com.example.advance.cm...
This post explains Composite design pattern with an example. When to use ? – Use Composite pattern when you have treat a collection of objects as they were once one thing. With Composite design pattern it is very easy to simplify operations over collection data structure. It reduces complexity of the code required if you were going to handle collection as special case. How to Use? - The Composite pattern consist of Component, Leaf and Composite Classes as shown below class diagram Component – Component declares the common interface that both the single and composite nodes will implements Leaf – The leaf class represent the singular atomic data type implementing he component interface. Composite – Composite is an abstract entity which declares common functionality which are needed by concrete implementation for handling collection data. An Example - Item.java public interface Item { public double getPrice(); ...
Disappointing .... :(
ReplyDeleteNo one can solve this or no one has time to look at ....
Anyway here is the answer
byte x = 100;
// or short x = 100; or char x = 100;
x = ++x; // valid
x = x + 1; // not valid
If I say I knew it, but read the question wrong, will you believe me?
ReplyDeleteYes i have to , as you have proof (similar but previous dated post) :)
ReplyDeleteOtherwise ... :)
Good one dude. ++ automatically involves casting while "+" does not , remembered this concept while I prepared for SCJP , some how didn't recall it quickly :)
ReplyDeleteThanks
Javin
How classpath works in Java
do you syntactically valid or both the statements should give same value of x ??
ReplyDelete