27.2k views
1 vote
Assume you have created a class named MyClass and that is contains a private field named

myField and a nonstatic public method named myMethod(). Which of the following is
true?
a. myMethod() has access to and can use myField
b. myMethod() does not have access to and cannot use myFeild.
c. myMethod() can use myField but cannot pass it to other methods.
d. myMethod() can use myField only in myField is passed to myMethod() as a
parameter.

1 Answer

2 votes

Answer:

a. myMethod() has access to and can use myField.

Step-by-step explanation:

Logic programming is a kind of programming which is largely based on formal logic. The statement are written in logical forms which express rules about the domain. In the given scenario the my method will have access to my field which is private field. My method non static public field can also use my field class.

User Hey Teacher
by
6.1k points