- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34494 Articles for Programming
![Rishi Raj](https://www.tutorialspoint.com/assets/profiles/13777/profile/60_73169-1512647303.jpg)
563 Views
transient: An instance variable is marked transient to indicate the JVM to skip the particular variable when serializing the object containing it. This modifier is included in the statement that creates the variable, preceding the class or data type of the variable.Examplepublic transient int limit = 55; // will not persist public int b; // will persistvolatile: The volatile modifier is used to let the JVM know that a thread accessing the variable must always merge its own private copy of the variable with the master copy in the memory.Accessing a volatile variable synchronizes all the cached copied ... Read More
![Jai Janardhan](https://www.tutorialspoint.com/assets/profiles/13513/profile/60_63529-1512538711.jpg)
457 Views
The volatile modifier is used to let the JVM understand that a thread accessing the variable should always merge its own personal copy of the variable with the original in the memory.Accessing a volatile variable synchronizes all the cached copy of the variables in the main memory. Volatile can only be applied to instance variables, which are of type object or private. A volatile object reference can be null.Examplepublic class MyRunnable implements Runnable { private volatile boolean active; public void run() { active = true; while (active) { } } public void stop() { active = false; } }
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
154 Views
An instance variable is marked transient to point the JVM to skip the actual variable once serializing the thing containing it. This modifier is included in the statement that creates the variable, preceding the class or data type of the variable. Example public class Employee implements java.io.Serializable { public String name; public String address; public transient int SSN; public int number; public void mailCheck() { System.out.println("Mailing a check to " + name + " ... Read More
![Moumita](https://www.tutorialspoint.com/assets/profiles/13507/profile/60_122499-1557898491.jpg)
953 Views
The final modifier can be associated with methods, classes and variables. Once declared final − A final class cannot be instantiated. A final method cannot be overridden. A final variable cannot be reassigned. Example Live Demo class TestExample { final int value = 10; public static final int BOXWIDTH = 6; static final String TITLE = "Manager"; public final void changeName() { System.out.println("This is a final method"); } } final class ... Read More
![Jayashree](https://www.tutorialspoint.com/assets/profiles/15002/profile/60_183575-1514465925.jpg)
32K+ Views
In C, ++ and -- operators are called increment and decrement operators. They are unary operators needing only one operand. Hence ++ as well as -- operator can appear before or after the operand with same effect. That means both i++ and ++i will be equivalent.i=5; i++; printf("%d", i);and i=5 ++i; printf("%d", i);both will make i=6.However, when increment expression is used along with assignment operator, then operator precedence will come into picture. i=5; j=i++;In this case, precedence of = is higher than postfix ++. So, value of i is assigned to i before incrementing i. Here j becomes 5 and i becomes 6.i=5; ... Read More
![Vikyath Ram](https://www.tutorialspoint.com/assets/profiles/13780/profile/60_74413-1512648006.jpg)
283 Views
An abstract keyword is used to declare methods abstract methods and abstract classes. Once a method is declared abstract we should not specify body for those. Example public abstract class Sample{ public abstract demo(){ } } Error Sample.java:2: error: invalid method declaration; return type required public abstract demo(){ ^ 1 error And once a class is declared abstract it cannot be instantiated. Example public abstract class Sample{ public abstract void demo(); public static void main(String args[]){ new Sample(); } } Error C:\Sample>javac Sample.java Sample.java:4: error: Sample is abstract; cannot be instantiated new Sample(); ^ 1 error
![Rishi Raj](https://www.tutorialspoint.com/assets/profiles/13777/profile/60_73169-1512647303.jpg)
1K+ Views
The synchronized keyword used to indicate that a method can be accessed by only one thread at a time. The synchronized modifier can be applied with any of the four access level modifiers. Example Live Demo public class TestThread { public static Object Lock1 = new Object(); public static Object Lock2 = new Object(); public static void main(String args[]) { ThreadDemo1 T1 = new ThreadDemo1(); ThreadDemo2 T2 = new ThreadDemo2(); ... Read More
![Rahul Sharma](https://www.tutorialspoint.com/assets/profiles/14297/profile/60_102977-1513054044.jpg)
452 Views
We can declare an array as a local variable or method parameter but, an array cannot be static. Example public class Test{ public void sample(){ static int[] myArray = {20, 30}; System.out.println(); } public static void main(String args[]){ Test t = new Test(); t.sample(); } } Error C:\Sample>javac Test.java Test.java:3: error: illegal start of expression static int[] myArray = {20, 30}; ^ 1 error