在java中我们假设我们有两个类和A,这样B继承A和A有3个私有字段和构造函数有三个参数
public class A {
private int a ;
private int b ;
private int c ;
public A(int a, int b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
}
Run Code Online (Sandbox Code Playgroud)
这是B级
public class B extends A {
public B() {
super(1,2,3);
}
}
Run Code Online (Sandbox Code Playgroud)
我们考虑以下测试类
public class TestA {
public static void main(String[] args) {
A a = new A(1,2,3);
B b = new B();
}
}
Run Code Online (Sandbox Code Playgroud)
问题是在创建具有私有字段的类A并由类B继承它时,堆中的有序进程是什么?在创建这两个类的实例时,堆中会发生什么?内存分配是如何发生的以及类如何在计算机memry中进行交互?
我们也知道子类不能继承其超类的私有字段,那么在A调用构造函数时会发生什么呢?
要将文本方向更改为从右到左,我们可以使用以下 CSS 代码:
direction:rtl; //displays text direction as right to left
Run Code Online (Sandbox Code Playgroud)
在 css 中有什么方法可以将整个页面布局方向从右到左反转,包括列表?
我有一个名为 'values' 的 pandas 列,其中包含相应的值10 15 36 95 99。我想从下一个值中减去每个值,以便获得以下格式:10 5 21 59 4
我试图使用循环遍历所有数据帧的 for 循环来解决这个问题,但这种方法很耗时。
for i in range(1,length_colulmn):
df['value'].iloc[i] = df['value'].iloc[i]-df['value'].iloc[i-1]
Run Code Online (Sandbox Code Playgroud)
数据帧功能是否有一种简单的方法可以快速解决这个问题?我们想要的输出如下:
['input']
11
15
22
27
36
69
77
['output']
11
4
7
5
9
33
8
Run Code Online (Sandbox Code Playgroud)