/**
* 标题:super关键字认识与使用
* 作者:Nstar 父类:Animal
* 时间:2020年3月9日
* 内容: 子类:Dog
* 问:什么是super关键字?
* 答:super关键字就像一个指针,他可以在子类重写父类的方法中调用原来父类的老方法,可以把重写过后的方法对应的老方法直接拿来做调用!
*/
class Animal{ //定义一个类作为基类,并且Dog继承于这个类
void spek(){ //定义父类方法,供子类重写与super关键字调用
System.out.println("发出叫声!!!");
}
void run(){ //定义父类方法,供子类重写与super关键字调用
System.out.println("跑起来!!!");
}
}
class Dog extends Animal{ //定义一个Dog类作为子类,并且使用extends关键字继承于Animal类
void spek(){
System.out.println("狗发出了叫声!!!"); //重写父类方法
super.spek(); //通过super关键字调用父类老方法
}
void run(){
System.out.println("狗跑起来!!!"); //重写父类方法
super.run(); //通过super关键字调用父类老方法
}
}
public class Test6 {
public static void main(String[] args) { //程序入口方法
Dog dog=new Dog(); //创建一个新对象,基于Dog类
dog.spek(); //通过实例调用Dog类spek方法
dog.run(); //通过实例调用Dog类spek方法
}
}
相关推荐
Flutter + shorebird 热更新+自定义cdn下载
本文介绍了如何优化Flutter热更新方案Shorebird在国内网络环境下的使用体验。Shorebird默认使用海外CDN存在下载慢、连接不稳定等问题,建议将补丁包上传至国内CDN(如阿里云OSS)。文章详细讲解了Shorebird环境配置、项目集成、构建发布流程,并重点说明了如何修改客户端代码实现自定义补丁下载逻辑。通过替换默认下载器,将补丁下载地址指向国内CDN,可显著提升下载速度和稳定性。这种方案既保留了Shorebird的热更新能力,又解决了国内网络环境下的痛点,适合国内企业部署使用。
python中super用法
Python中的super用法介绍
宝塔面板磁盘扩容后不生效?5步搞定Linux服务器磁盘空间更新(附详细命令)
本文详细解析了Linux服务器磁盘扩容后宝塔面板显示不生效的常见问题。通过理解磁盘、分区、文件系统三层逻辑,提供5步解决方案:检查磁盘状态、安装growpart工具、扩展分区、使用resize2fs命令扩展文件系统,并最终验证结果。文中附有详细命令和针对XFS、LVM等进阶场景的指南,帮助用户彻底解决磁盘空间更新问题。
Python中的Super详解,super怎么样使用代码
这篇文章我们来介绍一下 super,我相信大部分的人使用 super 都是使用这种方式; # 就是我有一个 class 比如说是 Male,然后继承另外一个 class 比如是 Person,然后我在这个 Male 也就是它的子类的 init 函数里面用 super().__init__() 来调用它父类的初识化函数 from objprint import op class Person: def __init__(self, name): self.name = na...
详解APM的开方控制器sqrt_controller
前言 前面说过,sqrt_controller是对P项进行整定用途的,目的就是让P项的控制响应“软”下来,实际上就是一个经过改进的P控制器。读懂了sqrt_controller,那么你对APM的P控制器就了解得差不多了。 仅讨论P控制器,sqrt_controller的作用就是设定一个量linear_dist,以这个量的正负值为分界线划分出一个线性区域范围,在这个范围内表示误差量还很小,遵循Kp*error计算方式输出控制量。 超过linear_dist后,表明误差较大,此时不能由着误差单纯按照线性方式乘以
pyecharts可视化图表-tree:从入门到精通
本文系统介绍了树图(Tree Chart)的可视化技巧,包含基础实现、方向定制和环形布局等实例。树图能清晰展示层次结构数据,适用于组织架构、文件系统等场景。教程详细解析了pyecharts树图的核心配置项,包括数据准备、方向设置(下上、右左)和样式定制,并提供了完整代码示例。通过本指南,读者可快速掌握专业树图的构建方法,实现复杂层次数据的可视化呈现。
java语言之super关键字详解
super关键字详解,super在JVM中的内存图模型,解释IDEA与eclipse使用快捷键生成构造方法时第一行出现super()是为什么
STM32开发 -- LIS3DH三轴加速度计开发详解
这次要讲一下LIS3DH三轴加速度计的开发使用,之前是有讲过 MPU6050开发 的,但当时是在Linux下做的。额,还是个半成品,哈哈。现在手边有STM32的开发板,可以实实在在的来实现以下卡尔曼滤波了。 一、LIS3DH初识 依照惯例,先看一下手册,大致先了解一下,LIS3DH是什么模块。 下载:LIS3DH datasheet 1、描述 LIS3DH是一款超低功耗高性能三轴线性加速度计,属于...
super详解
.....
复现论文《孤岛微电网环境下基于物理模型引导的深度强化学习VSG频率控制方法》
本文提出了一种结合物理模型与深度强化学习的孤岛微电网VSG频率控制方法。通过建立VSG小信号模型并设计可变系数控制器,将物理知识融入深度强化学习框架,解决了高维参数和机组耦合带来的控制难题。复现代码实现了三个核心组件:VSGSmallSignalModel建模VSG动态特性,VariableCoefficientController实现参数自适应调节,PhysicsGuidedDRL整合DQN算法与物理模型引导的奖励机制。该方法通过模型驱动与数据驱动的优势互补,提升了频率控制性能,其中物理模型既作为先验知识
企业数字化建设之——制造领域500强IT架构&落地
1.0 概念到市场,Idea to Market (ITM) ,集成产品开发 Integrated Product Development (IPD) ,产品从概念到上市的全生命周期管理,从客户中来,到客户中去,解决产品从0 - 1 的问题。14.0 流程、IT与变革管理,Manage Business Transformation & IT (MBT & IT),管理公司的业务流程、IT建设与组织变革。8.0 供应链管理,Supply Chain (SC),集成供应链管理,确保高效可靠的供应能力。
java中的super结合代码简单易懂
package text; /** 1.super不是引用类型,super中储存的不是内存地址,super指向的不是父类型对象 2.super代表的是当前子类对象中的父类型特征 3.super什么时候使用? 子类和父类中都有某个数据,例如,子类和父类都有name这个属性 如果要在子类中访问父类中的name属性,需要使用super 4.super可以用在什么地方? (1)super可以用在成员方法中 (2)super可以用在构造方法中 语法:super(实参);【只能
12.工具高级参数CogCalibNPointToNPointTool
CogCalibNPointToNPointTool是一种多点2D坐标校正工具,用于将图像像素坐标转换为物理世界坐标。该工具通过两组点(图像坐标点和物理坐标点)计算最佳转换关系,并将结果保存供后续使用。操作步骤包括获取图像、添加坐标点对、计算转换参数。校正结果会显示平移、缩放、旋转等参数及RMS误差值,较大的误差可能表明点位置不准确或自由度不足。该工具广泛应用于机器视觉领域,通过9点标定等案例可验证坐标转换的准确性并优化参数设置。
JavaSE总结 - Super关键字
零基础学Java,肝了bilibili的6百多集JavaSE教程传送门的学习笔记!!! 下面博客分为两部分: ① super关键字的要点(想快速了解super关键字的小伙伴选择) ② 案例代码,对①中的知识点进行解释(需要再花费8分钟学习的小伙伴选择) 一、super关键字的要点 1、super是一个关键字 2、super和this对比着学习: this: this出现在实例方法和构造方法中。 t.
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
jdk-8u144-linux-x64.tar.gz.
该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包
java调用父类方法 super_Java super关键字调用父类过程解析
这篇文章主要介绍了Java super关键字调用父类过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下话不多说,直接上代码:package com.my.pac14;/*** @auther Summerday*/public class SuperTest {public static void main(String[] args) {S...
C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片
基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正
Java-关键字-super
Java-关键字-super super关键字的理解 super表示超(父)类的意思,this表示对象本身。 super关键字代父类空间的引用。 super可用于访问父类被子类隐藏或覆盖的方法和属性,使用形式为 super.方法 。 在类的继承中,子类的构造方法中默认会有super()语句存在,不过默认是隐藏的,相当于执行父类的相应构造方法中的语句,如果显示使用必须位于类的第一行。 访问父类有参的构造方法,super不能省略,否则无法访问父类的有参构造方法,使用形式为super(xx,xx)。 supe
RU DOS版、EFI版32bit/64bit BIOS常用工具
DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。
【Java笔记】super关键字的使用
super关键字说明 我们可以在子类的方法或构造器中,通过使用 “super . 属性” 或 “super . 方法” ,显式的调用父类中声明的属性或方法(包括同名属性与重写方法)。但是在通常情况下,我们习惯省略 “super ”。 super调用构造器 1. 我们可以在子类的构造器中显式的使用 “supe(形参列表)” 的方式,调用父类中声明的指定构造器。 2. “supe(形参列表)”的使用,必须声明在子类构造器的首行。 3. 我们在类的构造器中,针对于“this(形参列表)” 或“sup..
面向对象(八)super关键字与final关键字
super关键字与final关键字
类和对象(3)——继承:extends关键字、super关键字、protected关键字、final关键字
在Java中,继承是指一个类(称为子类或派生类)可以获取另一个类(称为父类或基类)的属性和方法的机制。通过继承,子类可以复用父类的代码,并在此基础上添加新的属性和方法,从而实现代码的复用和扩展。
Java语言基础(6)面向对象——类的继承与方法覆盖(以及this、static、super、final关键字的使用解析)
面向对象——类的继承与方法覆盖(this、static、super、final关键字的使用解析)以及单例模式初步体验
解析java中的super关键字
本文详细解析了java中的super关键字的用法以及注意事项
final,static,this,super 关键字总结
final,static,this,super 关键字总结 final 关键字 static 关键字 this 关键字 super 关键字 参考 static 关键字详解 static 关键字主要有以下四种使用场景 修饰成员变量和成员方法(常用) 静态代码块 静态内部类 静态导包 补充内容 静态方法与非静态方法 static{}静态代码块与{}非静态代码块(构造代码块) 参考 ...
ES6对象的super关键字
ES6对象的super关键字 super是es6新出的关键字,它既可以当作函数使用,也可以当作对象使用,两种使用方法不尽相同 1.super用作函数使用的时候,代表父类的构造函数,es6规定在子类中使用this之前必须先执行一次super函数,super相当于Father.prototype.constructor.call(this) class Father{ construc...
java学习笔记-继承中super关键字
背景: 在java继承的概念中我们得知,被声明为私有的类成员对所属的类来说仍然是私有的。类之外的任何代码都不能访问,包括子类。 super关键字的两种用法: 1.用于调用超类的构造函数; 2.用于访问超类中被子类的某个成员隐藏的成员; 例:使用super调用超类的构造函数 矩形实体代码: public class Rectangular { private double wid
JavaSE-No.7.1——Java的继承(super关键字)
适合初学者的继承讲解,一起学习吧!!
782




被折叠的 条评论
为什么被折叠?



