Share on Google+Share on Google+

Srilakhsmi v k
Static final variables
1 Answer(s)      8 years ago
Posted in : Java Beginners


View Answers

February 26, 2009 at 6:47 AM


static final variable u can access in non-static method.

but the variable should has accessibility, means check the access specifier.

the following example may be useful for u.

class Xyz{
private static final String name="xyz";

public void displayData(){

System.out.println("name is "+name);//within class u can access the variable 'name'

class Abc extends Xyz{
public void display(){

System.out.println("name is "+name);//here u can't access the variable 'name'.


siva kumar

Related Tutorials/Questions & Answers:
Static final variables - Java Beginners
Static final variables  can a static final variable be accessed by a instance (non-static)method?  Hi, static final variable u can... Xyz{ private static final String name="xyz"; public void displayData
private static final
private static final  Why there is necessary to make a variable private static final
Static & Instance variables in java
Static & Instance variables in java  What are the Difference between Static & Instance variables in java
final  what does final means in "public static final void main (string args[])" ?   keyword final can be assigned only once. They cannot be modified
Static  Can i know the real time example for Static method and final variables with defenition? Thank you
Java final keyword
with the name "Final" in a Java program. We can have final methods, final classes, final data members, final local variables and final parameters. When...Java final keyword The final is a very important keyword in java, which
Variables  What are the difference between Static variables, instance variables and local variables
PHP Variables Static
PHP Variables Static PHP static variable is used to remember the value... is running a static variable is only retained by the function , but it is NOT shared... disappears, Once the function is finished. To solve this problem we use PHP static
,then go for static methods. If we want variables those values will not be changed from object to anther object,then go for static variables...(According to my...Static Concept  in what are all the situation we may use static
in all objects.They are not re-created or re-initialized. Static variables...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
is applied to member variables, it means that the static variable is shared among all...static  what r the main uses of static in java   Hi Friend, The Static means that a certain object/variable is resident in memory
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
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
The final Keyword
final methods, final classes, final data members, final local variables and final parameters.   variables: A variable declared with the final.... private and static methods are always implicitly final
final keyword
final keyword  why is final keyword used in java
Final Keyword
Final Keyword  hello, What is final?   hii In case of class if we use final then this class can not be extended or final class may not be subclassed. A final method can't be overridden when its class is inherited
final variable
final variable  Please give some easiest and understanding example program for final variable
interface variables - Java Beginners
interface variables  why interface variables are final? explain me with good program example?? i knw why the variable is static but,i dont knw why it is final by default? thanks in advance
final grade
final grade  C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point...?s final grade from 50-100. Evaluate the Final grade and display the Point
Final Methods - Java Tutorials
; The fields which are declared as static, final and public are known as named...{ public static final double x = 2.998E8; } final method arguments You can also...The final Keyword in Java In Java, final keyword is applied in various context
static methods
static methods  why static methods cannot read or write the instance variables
PHP Static Variable and Methods
PHP Static Methods and Variables: In this tutorial we will study when we should use static methods and variables. Static keyword is used to make only one... Variables & Methods : <?php class One{ private static $var=0
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 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... variables). 2)A static method can call only other static methods and can not call
static functions
static functions  Give some brief defenition for 1. Static Variables 2. Static Functions 3. Instance Variable  Static Variables Static... variables. 3)A single copy to be shared by all instances of the class. 4)A static
Java final
classes, final data members, final local variables and final parameters. 1. variables: A final variable can be set once and only once. 2. methods: A final method... Java final      
Java final Keyword Example
final void methodName1() { ...... } public static final... methodName1() { ...... } public static final void methodName2...() { ...... } } Keyword final with Variables In Java the final keyword can be used
Static Variable
of a class, an object, is created. When static is applied to member variables...Static Variable  What is the basic use of introducing static variable type in java?Please explain clearly....   The Static means
an instance of a class. Static methods are implicitly final method, since overriding... final. However, a static method can't be overridden by a nonstatic method. Or we... Static       Static
getting variables
getting variables   how to get variables from servlet program to webservice program
Squaring of two number in Static class
Squaring of two number in Static class  ... static method and how can display multiplication of two any number. The static method use no instance variables of any object of the class they are defined
Java Spring Hibernate Struts Training Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? file location SASLError using PLAIN: not-authorized


Advertisement null