Transient keyword is used by java programmers for variables, if the programmer does not want to store them permanently.
In case of serialization, the fields which are kept transient, are not the part of serialization process and not serialized.
Volatile is used along with the variable name, that can change its value without informing the JVM.
The system clock values are stored in Volatile variable.
They do not inform JVM when they change their value.
Chat with our AI personalities
It ensures that the current value of the variable is read, rather than (perhaps) a cached version caused by some compiler optimization. From Wikipedia: "Generally speaking, the volatile keyword is intended to prevent the compiler from applying any optimizations on the code that assume values of variables cannot change "on their own.""
If you mark an instance variable as transient, you're telling the JVM to skip (ignore) this variable when you attempt to serialize the object containing it. Don't worry about Serialization just yet. That is a cool feature of java that we shall be seeing in greater detail in one of the subsequent chapters. For not it is enough to know that a transient variable will be ignored when the object is serialized.
Transient Variables
If you mark an instance variable as transient, you're telling the JVM to skip (ignore) this variable when you attempt to serialize the object containing it. Don't worry about Serialization just yet. That is a cool feature of java that we shall be seeing in greater detail in one of the subsequent chapters. For not it is enough to know that a transient variable will be ignored when the object is serialized.
Volatile Variables
The volatile modifier tells the JVM that a thread accessing the variable must always reconcile its own private copy of the variable with the master copy in memory. Did you understand that? Don't worry about it. For the exam, all you need to know about volatile is that, similar to the transient keyword, it can be applied only to instance variables. It is also important to note that using volatile keyword for variable in a class where you are implementing multi-threading is a bad bad idea.
No, 'check' is not a keyword in java language.
No extern keyword in Java.
There is no "foreign" keyword in Java, however, there is a native keyword that declares native methods in a native language, such as C or C++.For full list of keywords in Java see related question.
Literal in java are L, F, null, true, false These act as keyword(have special meaning in java) but these does'nt comes under the category of Java Keyword.
Java does not have multiple inheritance, so no. Java can use multiple interfaces, though, with the "implements" keyword.