answersLogoWhite

0


Best Answer

Static data field - the field is set at the start of the program (if creating a program) and can not be changed, its value will be constant.

Instance data field - can be manipulated by the user, so that its value can be stored: for example you have a data field storing how many hours a person can work in one day, the field will be static as there are always 24h in a day and that can not change.

If you have a second data field storing how many hours a certain employee worked that field will be an instance data field as its values can differ.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between an instance data field and static data field?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Whats the difference between static and constant?

The value of a static readonly field is set at runtime; therefore, the value can be modified by the containing class. On the other hand, the value of a const field is set to a compile-time constant. In the case of static readonly, the containing class is allowed to modify the value only: * in the variable declaration (via a variable initializer) * in the static constructor (or instance constructors for non-static)Typically, static readonly is used either when the value is unknown at compile time or if the type of the field is not allowed in a const declaration. Also, instance readonly fields are allowed. Note: for reference types, in both cases-static and instance-the readonly modifier only prevents assignment of a new reference to the field. It does not specifically make the object pointed to by the reference immutable.


What is members in java?

A member class is a class that is declared as a non-static member of a containing class. If a static member class is analogous to a class field or class method, a member class is analogous to an instance field or instance method.by k7


What is the difference between a field survey and a field experiment?

differentiate between field experiment and survey and advantages


What is the difference between bench and field springer spaniel variety?

whats the difference in temperament between field springer spanialels and show.


How nonstatic fields can be used in public static void main of a class?

They can't be. If you want to use a non-static field in a static method, you need an instance of the class to reference. class MyClass { int myX; static int staticX; public static void main(String[] args) { // We can directly reference staticX whenever we want. staticX = 10; // We need an instance of MyClass to use myX. MyClass mc = new MyClass(); mc.myX = 10; } }


What is static in c sharp programs?

Static is a modifier used in C# to declare a static member. The static modifier can be used with fields, methods, properties, operators, events and constructors, but cannot be used with indexers, destructors, or types.A static member cannot be referenced through an instance. Instead, it is referenced through the type name for example class name.public class MyBaseC { public struct MyStruct { public static int x = 100; } } MyBaseC.MyStruct.x While an instance of a class contains a separate copy of all instance fields of the class, there is only one copy of each static field. It is not possible to use this to reference static methods or property accessors.For more information please refer to the related links.


What does instance field mean in Java?

Fields defined without the "static" keyword.Their value is unique to each instance (object) of a class.AnswerInstance variable is a variable declared within the class for which every object of the class has its own value.


What is difference between instance variable and class variable in java?

The main difference between the class variable and Instance variable is, first time, when class is loaded in to memory, then only memory is allocated for all class variables. Usually static variables are called class variables. These variables are available throughout the execution of the application and the values are common to the class. You can access them directly without creating an object of the class. Instance variables are normal variables declared in a class, that would get initialized when you create an instance of the class. Every instance of the class would have a copy of the variable and you need a class instance (object) to access these variables


What is the difference between field crops and pastures?

nofin


What is the difference between you do and you play in sports?

I do track and field


Is the temperature field map a static or dynamic field?

dynamic


What is the phase difference between electric and magnetic field?

Zero.