Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Answers Viewqa Java-Beginners about static import

Have Programming Question? Ask it here!

about static import
1 Answer(s)      4 years and 8 months ago
Posted in : Java Beginners

View Answers

August 25, 2009 at 4:34 PM

Hi Friend,

No,it is not correct.The class you are importing is not static.

Use public modifier instead of protected modifier in Class A with the variable i. By using public modifier,the variable will be accessible to any class of any package.

Try the following code:


package mypack;

public class TestA
public static int i=100;


import static mypack.TestA;

public class TestABC
public static void main (String [] arg) {
TestA testa = new TestA ();



Related Tutorials/Questions & Answers:
about static import - Java Beginners
about static import  Hello Friend below program is not running when... to ask that "static import" syntax is correct or not package mypackage1... A { protected static int i=5; } package mypackage2; import static mypackage1.A.
Java static import
Java static import  What is the use of static import
About Static Class
About Static Class  is it neccessary to create object for static class
of the class that is initialized. Another thing about static objects is that you...Static Concept  in what are all the situation we may use static...,then use static blocks and without creation of object we need to perform some task
STATIC  WHAT IS STATIC BLOCK?EXPLAIN , AND WHAT IS THE DIFFERENCE BETWEEN STATIC BLOCK AND STATIC METHOD?   A STATIC block is automatically... between static block and static method: static block will execute when ever
static  what r the main uses of static in java   Hi Friend, The Static means that a certain object/variable is resident in memory and accessed each time an instance of a class, an object, is created. When static
Static  Can i know the real time example for Static method and final variables with defenition? Thank you
static  What is the exact need of declaring a variable as static?   A static variable is a variable who's single copy in memory is shared by all objects,so any modifications to the static variable will modify it's value
redeclare static variable in the inherited class  can we redeclare static variable in the inherited class like this: public class StaticClass1 { class StaticClass1{ static int noOfInstances; StaticClass1
Local Variable ,Package & import
Local Variable ,Package & import A local variable has a local scope.Such... Variable public class LocalVar { public static void main(String args... the Class Variable public class ClassVar { private static int
static keyword in java
.style1 { color: #0000FF; } static keyword in java We are going to discuss about static keyword in java. The static keyword is a special keyword in java programming language. A static member belongs to a class
import file
import file    public void importFile(BlobDomain fileData) { InputStream inStr = fileData.getInputStream(); Workbook workbook = Workbook.getWorkbook(inStr); Sheet sheet = workbook.getSheet(0); int colCount
"import" Attribute of page directive
will discuss about the "import" attribute of a JSP & its use in JSP page. A directive element in a JSP page provides global information about a particular JSP page. Page directive attributes that notify the Web container about
in a subclass. To read more about static click at: Static       Static... an instance of a class. Static methods are implicitly final method, since overriding
static keyword
static keyword  please give some detail about Static keyword.   Static Variables Static variables are class variables that are shared... and not to object(instance). 2)Static variables are initialized only once , at the start
Static Parameter, Static Parameter in Struts 2, Struts 2 Static Parameter
the three static parameters by using the setParameter1(), setParameter2... a jsp page(showparameters.jsp) to view the static parameters.  ... that contains three static parameters in key-value format . Output of this application
Static Resources Configuration
In this section, you will learn about Static Resources Configuration through MVC Java config and XML Namespace
static in java
static in java  what is the need to go static? what use
Static method
Static method  what is a static method?   Have a look at the following link: Java Static Method
PHP Late Static Binding
PHP Late Static Binding: A new feature called late static binding... static binding is coined because of the static:: will no longer be resolved using... { public static function classIdentifier() { echo __CLASS__; } public static
static method
static method  Give some absolute examples and definition for static method also
static methods
static methods  why static methods cannot read or write the instance variables
static functions
static functions  Give some brief defenition for 1. Static Variables 2. Static Functions 3. Instance Variable  Static Variables Static...)It is a variable which belongs to the class and not to object(instance). 2)Static
static keyword
static keyword  Hii, In which portion of memory static variables stored in java. Is it take memory at compile time? thanks deepak mishra
Static Variable
Static Variable  What is the basic use of introducing static variable type in java?Please explain clearly....   The Static means... of a class, an object, is created. When static is applied to member variables
import package.subpackage.* does not work
("funA"); } } import com.test.*; class C { public static...import package.subpackage.* does not work  I have 3 class files.... A a = new A(); ^ 2 errors But when instead of import
Packages and Import
classes. import FAQ Q: Does importing all classes in a package make my object... for symbols. Q: Is it less efficient to import all classes than only... difference. Q: Doesn't it provide better documentation to import each class
Import attribute of page directive
Import attribute of page directive   How use import attribute of page directive ?   The import attribute is used to import all the classes... that the JSP page wants to import, the programmer can use import more than once
Problem of Import JWorkbook
Problem of Import JWorkbook  Hi... i can't use the jworkbook in my project.what types of library files in import
import package - JSP-Servlet
import package  how to import a package into a jsp page...pls reply with an example..  Hi friend, To import a package in Jsp use the import Attribute of page Directive In JSP The package name folder is putted
jfree missing import file
jfree missing import file  hi....... i have checked the jar file of jfree that import file of RECTANGLEINSETS is not there then what to do now? how to solve this problem? plz help?   Download jcommon-1.0.16.jar
jfree missing import file
jfree missing import file  hi....... i have checked the jar file of jfree that import file of RECTANGLEINSETS is not there then what to do now? how to solve this problem? plz help?   Download jcommon-1.0.16.jar
jfree missing import file
jfree missing import file  hi....... i have checked the jar file of jfree that import file of RECTANGLEINSETS is not there then what to do now? how to solve this problem? plz help?   Download jcommon-1.0.16.jar
jfree missing import file
jfree missing import file  hi....... i have checked the jar file of jfree that import file of RECTANGLEINSETS is not there then what to do now? how to solve this problem? plz help?   Download jcommon-1.0.16.jar
import org.hibernate.Session error
import org.hibernate.Session error  I am new to hibernate. I have followed the given steps but it could not recognize hibernate.session and other imports. what i need to do?   Hi, Are you using Eclipse? Please let's
The import keyword
. Java versions from J2SE 5.0 to upward can import the static members... The import keyword       The import statement make available one or all the classes in a package
demonstrate a) static data members b) static methods
demonstrate a) static data members b) static methods  demonstrate a) static data members b) static methods
static keyword in interface
static keyword in interface  Could any one explain,why static keyword implict (or explict ) come in interface? I asked lot of persons about this question, but nobody did not answered clearly. please explain clearly and say what
What is static factory pattern?
What is static factory pattern?  Hello, please tell me what is static factory pattern? Thank you..   Dear friend, you can go through the following links to better understand the static factory pattern - Factory
Static keyword in public static void main
Static keyword in public static void main  Hi, I have seen that on page mentioned below for static keyword explanation given is: Page: http...: static keyword indicates that this method can be invoked simply by using the name
JSP import
JSP import         An import is the attribute of the page directive in JSP that imports... packagename.classname or import all classes of the package by using packagename
Java Import Statement Cleanup - Java Tutorials
Java Import Statement Cleanup 2002-06-18 The Java Specialists' Newsletter [Issue 051] - Java Import Statement Cleanup Author: Dr. Cay S. Horstmann..." series. Cay very kindly pointed me to an article that he wrote about a tool he
Import My Own Package (Automatically)
Import My Own Package (Automatically)   How can I import my own package in every java program ( automatically )....? For example :- java.lang.String... automatically imported, we need not to import
Import MYSQL file in PHP - PHP
Import MYSQL file in PHP  i wanted to import the mysql file in PHP5 on button click. is it possible to do it? Is there any possibility of data security
static keyword with real example
static keyword with real example  static keyword with real examplestrong text
Java static method
Java static method  Can we override static methods
why using static keyword
why using static keyword  why using static keyword
Import Data to SQL database in Java
Import Data to SQL database in Java  Hi, I'm a beginner and I'm wondering how to Import Data to SQL database in Java? Thanks (Platform: Eclipse/SQL
Page Directive attribute - import
Page Directive attribute - import This tutorial  contains description of import attribute of page Directive. import  Attribute : This attribute... and classes . For multiple import you can use comma(,) for separation. By default