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...
As we all know Hash is a part of Java Collection framework and stores key-value pairs. HashMap uses hash Code value of key object to locate their possible in under line collection data structure, to be specific it is nothing but array. Hash code value of key object decide index of array where value object get stored. As per hashcode – equals method implementation rules Objects that are equal according to the equals method must return the same hashCode value. & If two objects are not equal according to equals, they are not required to return different hashCode values. As per above statement it is possible that two different object may have same hashcode values, this is called hashcode collision . To overcome this problem concept of bucket has been introduced. All the Value objects whose corresponding Key’s hashcode values are same , they fall under same bucket. Above diagram explains hash code collision. There are three key-value entries are shown , out of which second and thi...
Has your SPA accessibility compliance done ? Ahhh … let me get back to you. That’s usual scenario for dynamic single page application. Since content of the web app changes dynamically/asynchronously. It required need addition planning to make dynamic web accessibility complain. For those who are new to web accessibility The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect. There are many tools are being provided to make the web accessible like screen reader. The screen reader read out the html content with help of aria attributes. One of the accessibility attribute is aria-sort . It let the user know that the given html table is sorted by of the its column and in which order. The sorted column of the table expected to have ng-aria=”ascending/descending”. The problem with SPA table is that on sorting the table the content get sorted without loading the web, so having static aria-sort attribute is going t...
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