Results 1 to 8 of 8
  1. #1

  2. #2
    Junior Member
    Join Date
    May 2016
    Posts
    28
    Static import is a feature introduced in the Java programming language that allows members (fields and methods) defined in a class as public static to be used in Java code without specifying the class in which the field is defined. This feature was introduced into the language in version 5.0.

  3. #3
    Junior Member
    Join Date
    Feb 2016
    Posts
    14
    Static import is introduced in Java 5 along with other features like Generics, Enum, Autoboxing and Unboxing and variable argument methods.

  4. #4
    Member
    Join Date
    May 2016
    Posts
    36
    The static import feature of Java 5 facilitate the java programmer to access any static member of a class directly. There is no need to qualify it by the class name.

  5. #5
    Registered User
    Join Date
    May 2016
    Posts
    122
    Static import is a feature introduced in the Java programming language that allows members (fields and methods) defined in a class as public static to be used in Java code without specifying the class in which the field is defined.

  6. #6
    Registered User
    Join Date
    Mar 2019
    Location
    Ahmedabad
    Posts
    76
    As import statement allows to use a class without its package qualification, static import allows to access the static members of a class without class qualifications.

    To understand this topic, you should have the knowledge of packages in Java. If you hate to type same thing again and again then you may find such imports interesting.

    For Example, to access the static methods you need to call the using class name

    Math.sqrt(169);

    But, using static import you can access the static methods directly.

    Example

    import static java.lang.Math.*;

    public class Sample{
    public static void main(String args[]){
    System.out.println(sqrt(169));
    }
    }


    Output

    13.0

  7. #7
    Registered User
    Join Date
    Jan 2020
    Posts
    27
    hello,priya

    static import is use to access the static method of a class without using full class name.
    As import statement allows to use a class without its package qualification, static import allows to access the
    static members of a class without class qualifications.For Example, to access the static methods you need to
    call the using class name.
    static import is use to access the static method of a class without using full class name

    if you write a code with lot of mathematical calculations so you may to use static import.
    like Math.sqrt(289);

    I hope this'll help you.

  8. #8
    Senior Member
    Join Date
    Jun 2013
    Location
    Forum
    Posts
    4,825
    Static import is a feature introduced in the Java programming language that allows members (fields and methods) which have been scoped within their container class as public static , to be used in Java code without specifying the class in which the field has been defined.
    Cheap VPS | $1 VPS Hosting
    Windows VPS Hosting | Windows with Remote Desktop
    Cheap Dedicated Server | Free IPMI Setup

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.