answersLogoWhite

0


Best Answer

An accessor method can be used to get a value from a class without changing the value.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What method gets a value from a class s field but does not change it?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What does 'public static final int' mean?

public: It can be called (method) or accessed (field) from any class in any package.static: It is declared on the class rather than the object. If a method, you do not need an object to call it, it can be called directly on the class. If a field, there is only one variable for the class, not one per object.final: If a method, the method cannot be overridden. If a field, the value cannot be changed (a constant).int: If a method, the return type. If a field, the field type (it can only hold values of type 'int'). int is the primitive integer type.


What does Error converting data type to numeric means?

You must have declared a method which tries to convert a variable/field value into a numeric value but that is not possible. Refer to the line on which the error is found and remove the method which tries to convert the variable/field. Note: Java allows type casting so a string cannot be converted into integer even if a method tries to change the value


What is the class of the standard error output as found in the static field of the System class java.lang.System.err?

The static field java.lang.System.err is än object of type java.io.PrintStream.The default value of System.err is new FileOutputStream(java.io.FileDescriptor.err).For details, view the source code of System class and review the private initializeSystemClass() method.


Why do you need to override the toString method?

By default every class you write inherently extends the base Object class. This has a basic toString() method which merely returns the name of the class followed by a hex representation of the hash value. By overriding this method, you can return a more meaningful value specific to your class, such as member attributes and their values.


What is the use of passing an argument by value?

Passing an argument by value means that the method that receives the argument can not change the value of the argument. Passing an argument by reference means that the method that receives the argument can change the value of the incoming argument, and the argument may be changed in the orignal calling method.

Related questions

What does 'public static final int' mean?

public: It can be called (method) or accessed (field) from any class in any package.static: It is declared on the class rather than the object. If a method, you do not need an object to call it, it can be called directly on the class. If a field, there is only one variable for the class, not one per object.final: If a method, the method cannot be overridden. If a field, the value cannot be changed (a constant).int: If a method, the return type. If a field, the field type (it can only hold values of type 'int'). int is the primitive integer type.


What happens in programming any time a local variable in a method has the same identifier as a class field?

the program will work fine the value will be considered as the value of local variable in the particular method.


What does Error converting data type to numeric means?

You must have declared a method which tries to convert a variable/field value into a numeric value but that is not possible. Refer to the line on which the error is found and remove the method which tries to convert the variable/field. Note: Java allows type casting so a string cannot be converted into integer even if a method tries to change the value


What is the class of the standard error output as found in the static field of the System class java.lang.System.err?

The static field java.lang.System.err is än object of type java.io.PrintStream.The default value of System.err is new FileOutputStream(java.io.FileDescriptor.err).For details, view the source code of System class and review the private initializeSystemClass() method.


Why do you need to override the toString method?

By default every class you write inherently extends the base Object class. This has a basic toString() method which merely returns the name of the class followed by a hex representation of the hash value. By overriding this method, you can return a more meaningful value specific to your class, such as member attributes and their values.


What is the use of passing an argument by value?

Passing an argument by value means that the method that receives the argument can not change the value of the argument. Passing an argument by reference means that the method that receives the argument can change the value of the incoming argument, and the argument may be changed in the orignal calling method.


What is the change in field value over distance?

Gradient.


Explain different use of super with the help of java program?

the keyword super is used to access methods/variables of the parent class. ex: public class A { public String getName(){ ..... } } public class B extends A { public String getName(){ ..... } } If you want to access the method getName of class A inside class B you cannot do directly because the compiler would get confused. you need not create an object of A since it is already available. At this point you can use super super.getName() is enough to call the method of the parent class


Which is the default variable storage class type in a function?

Everything is an object, and "typed" based on assignation. Your variable will be given a class when you declare it to be something, and the class will depend on what value you give the variable. It is always an object though, and its class may change if you change its value.


Difference in using a method that return value and method that does not return value in object orinted programming?

A method that return a value should have a return statement. The method signature should indicate the type of return value. While in the case of a method that does not return a value should not have a return statement and in the signature, the return type is void. When using a method that doesn't return a value, a programmer can not get a value from that function, but instead, it can only change variable values and run other methods.


Can the value of a field and its rate of change both be exactly zero?

sure


What is the temperature gradient formula?

Gradient= Change in field value/Distance