What is static in Java. Let's talk about this topic today. Static modifiers apply variable methods to strange types of code. This type of code is not part of the method. Think of static features as class-related.  Whether they are linked to unique instances of the class. The following example shows a simple class with a single static variable. 

1.class Ecstatic {

2.static  int x=0;

3.Ecstatic ( ) i x++;}


 The variable is X static.  No matter, there are many examples. Classes of Ecstatic that exist at any particular moment. There is one or more or none of Ecstatic. There is always only one x set. 4 bytes of memory are equal to x  Taxes are determined when the class has an ecstatic load. The identification of zero also occurs at the class load time. The static variable is called a constructor as it increases all the time. So it is possible to know how many instances have been made.  But there are other ways to refer to a static variable. Ways to refer to any instance of the class * Ways to name the class. The first method works but the result is in the confusion code.  The following examples show how this happens.

1.Ecstratic e1=new Ecstatic ( );

2.Ecstatic  e2= new Ecstatic ( );

3.e1.x =100;

4.e2.x = 200;

5.really Important Variable =e1.x;

And when it comes to exceptions, there are times when the program runs, and there are times when there are round review points on hand.  For example, when a user enters an invalid file name or retrieves file-cached data, the network link fails.  This type of condition is called exception condition in Java. If you do not take any step to double with exception, execution jumps to the end of the current method.  The exception reappears in the collar of this method. And the exception jumps to the end of the calling method. This continues.  The process of exception is done with the immediate cause of appealing trouble or because the method is assigned to the call and passes the exception on its collar.  This is called exception throwing in Java.

More Posts

Cannot make a static reference to the non-static method in java Tania - Sep 7
Why we cannot make a static reference to the non-static method? mhfaisal - May 14
How to reference a non static method in java Sanjana Sagar - May 20
Cannot make a static reference to the non-static method java SharadMagar450 - Aug 5
write a class that has three overloaded static methods for calculating the areas of the shapes - Java DivyaN - Sep 3
Difference between static and final variable in java Huzaifa-Glitch - May 29
How to call non static method from static method in java? Hafsa_Rao - Jun 30
What is public static void main (string args[ ])? Being human - May 27
The static method should be accessed in a static way Hafsa_Rao - Jul 17
Difference between method and function in java with example Tania - Aug 17