TechieDrill Your World Of Technical Tutorials

Posts Tagged ‘static’

Java Static ArrayCopy

11.23.2009 · Posted in Java

Java offers a static ArrayCopy method from System class: java.lang.System.arraycopy() method offers a convenient method to copy array elements from one array to another. System.arraycopy(Object source_array, int source_position, Object destination_array, int destination_position, number_of_elements) System.arraycopy() takes five parameters. First parameter specifies the source_array from where the elements need to be copied. Second parameter is the position(index) value of the source array ...

Understanding Java Static block/variables/method

11.20.2009 · Posted in Java

lass UseStatic { static int a=3; static int b; static void meth(int x) { System.out.println(”x: “+x); System.out.println(”a: “+a); System.out.println(”b: “+b); } static { System.out.println(”static block initialized: “); b=a*4; } public static void main(String [] args) { meth(42); } } Static block/variables/methods are very powerful in java. When we say static it is static throughout the application. If you declare ...