Thursday, August 15, 2013

Static import using java

Static Import:


The programmer to access any static member of a

class directly.

Here no need class name or method name.If we

import like static java.lang.Math.*; means we can use any

mathematics function within a program.

Example:


import static java.lang.Math.*;

public class StaticImport {

public static void main(String args[])

{

System.out.println("Square value"+sqrt(64.0));

System.out.println("Power value"+ceil(-7));

}


learn more on static import java training in chennai or java tutorial

Output:

Square value8.0

Power value-7.0

No comments:

Post a Comment