当前位置:网站首页>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
边栏推荐
- new URL(“www.jjj.com“)
- SQL injection file read / write
- 构造方法绝不是在new()之后就立马执行!!!!!
- It only takes two steps to find the right PMP organization, one check and two questions
- Deployment of MySQL database in Linux Environment
- Analysis of prepaid power purchase device
- 分而治之之经典Hanoi
- Implementation of single sign on
- [.Net6] GRP server and client development cases, as well as the access efficiency duel between the minimum API service, GRP service and traditional webapi service
- 电子元器件销售ERP管理系统哪个比较好?
猜你喜欢
![[untitled]](/img/bb/213f213c695795daecb81a4cf2adcd.jpg)
[untitled]

Decision table method for basic content learning of software testing (2)

Discussion on the practice of fire emergency lighting system in the field of building electrical design

Almost union find (weighted union search)

Basic knowledge of hard disk (head, track, sector, cylinder)

What are the advantages of a differential probe over a conventional probe

Why does select * lead to low query efficiency?

Data mining modeling practice

redis5.0的槽点迁移,随意玩(单机迁移集群)

Discussion on the improvement and application of the prepayment system in the management of electricity charge and price
随机推荐
怎样在手机上开户?现在网上开户安全么?
Ffmpeg streaming fails to update header with correct duration
Batch modify tables and sorting rules for fields in tables
基于宽表的数据建模
批量修改表和表中字段排序规则
Apiccloud, together with 360 Tianyu, helps enterprises keep the "first pass" of APP security
Rich text - Test Case
股票 停牌
Test cases for learning the basic content of software testing (II)
Power data
SQL 优化经历:从 30248秒到 0.001秒的经历
【大案例】学成在线网站
图解MySQL的binlog、redo log和undo log
Fastjason filter field
DEJA_VU3D - Cesium功能集 之 052-模拟卫星轨道(高空)效果
How do individuals open accounts to speculate in stocks? Is online account opening safe?
Characteristics and prevention of electrical fire
从知识到智慧:知识图谱还要走多远?
状态机程序框架
买卖股票费用计算