当前位置:网站首页>The private attribute of this class can be used directly? New() in use!!!
The private attribute of this class can be used directly? New() in use!!!
2022-06-28 09:07:00 【C_ x_ three hundred and thirty】
The following are known Test Class description , In this category main At the horizontal line of the method , Which of the following statements is true ?()
public class Test
{
private float f = 1.0f;
int m = 12;
static int n = 1;
public static void main (String args[])
{
Test t = new Test();
————————
}
}
t.f = 1; correctthis.n = 1;Test.m = 1;Test.f = 1;If in the same class , Just like this problem, construct an instance object to Direct access to private member variables or private methods is possible , The premise is that you must new() Only an object can call these private properties , Never use it alone , Otherwise, it still reports an error !
however , Even if there are different classes under the same package , for example :B Class has private properties , you are here A Create another B class , At this point, you can't directly call private properties , You have to pass get()、set() Operate it
边栏推荐
- Deployment of MySQL database in Linux Environment
- How to solve the problem of high concurrency and seckill
- Is it safe to open an account for online stock speculation?
- Find the total number of 1 appearing in the integer 1-N and the number of 1 in the binary of the integer
- 1182:合影效果
- 在本类私有属性直接使用?new()在使用!!!
- Applet: traverse the value of an array in the list, which is equivalent to for= "list" list An item in comment
- 1. Kimball dimension modeling of data warehouse: what is a fact table?
- 基于宽表的数据建模
- Screen settings in the source code of OBS Live Room
猜你喜欢

APICloud携手三六零天御,助力企业守好App安全“第一关”

Application of energy management system in iron and steel enterprises

Data modeling based on wide table

Illustration of MySQL binlog, redo log and undo log

JMeter -- interface test 1

基于宽表的数据建模

Which is a better ERP management system for electronic component sales?

containerd1.5.5的安装

Common test method used by testers --- orthogonal method

Valentine's Day - VBS learning (sentences, love words)
随机推荐
Operating principle of Rogowski coil
Is it safe for Huatai Securities to open an account online? What is the handling process
Which is a better ERP management system for electronic component sales?
DEJA_ Vu3d - 052 of cesium feature set - Simulation of satellite orbit (high altitude) effect
[untitled]
Import and export of a single collection in postman
Error: `brew cask` is no longer a `brew` command. Use `brew <command> --cask` instead.
[big case] Xuecheng online website
Where is CentOS mysql5.5 configuration file
JMeter -- interface test 1
Using transform:scale causes the page mouse hover event to disappear
Decision table method for basic content learning of software testing (2)
Discussion on the improvement and application of the prepayment system in the management of electricity charge and price
手机买同业存单基金开户选哪家证券公司比较好,比较安全呢
中金财富开户安全吗?怎么收费?
Chrome devtools
[cloud native | kubernetes] in depth understanding of pod (VI)
Fastjason filter field
Discussion on safety management of centralized maintenance construction site of substation under the mode of operation and maintenance
買賣股票費用計算