我想回答以下问题:
子类不会继承父类的某些成员.说出三个这样的成员.
我知道私有成员不会继承到子类,并且默认成员不会在包外继承.任何人都可以完成答案吗?
编辑: - 我相信静态成员是根据以下演示继承的
public class sup {
public static void main(String agr[]){
}
protected static int staticInt=0;
protected final int finalInt=3;
protected int protectedInt=0;
public String publicString = "";
private int privateInt=8;
}
class sub extends sup{
public void del(){
staticInt=1;
staticInt=finalInt;
}
}
Run Code Online (Sandbox Code Playgroud) 有一个简单的程序,在构造函数中,super()被调用而没有扩展到超类,我无法理解在这种情况下会做什么呢?
public class Student {
private String name;
private int rollNum;
Student(String name,int rollNum){
super(); //I can not understand why super keyword here.
this.name=name;
this.rollNum=rollNum;
}
public static void main(String[] args) {
Student s1 = new Student("A",1);
Student s2 = new Student("A",1);
System.out.println(s1.equals(s2));
}
}
Run Code Online (Sandbox Code Playgroud) 我使用 sequelize 创建了一个带有时间戳的表。当我更新表时,它会自动更新时间戳(即 createdAt 和 updatedAt)。但这些时间与我的当地时间不同。如果我使用 moment 像这样转换时区,我附上了 2 个带有模型脚本的屏幕截图,updateddAt: moment().utc(new Date())它工作正常。有没有办法用当前时区自动更新时间戳?
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('States', {
hashCode: {
type: Sequelize.STRING,
unique:true,
autoIncrement:false
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('States');
}
};
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用ms bot框架创建一个Bot应用程序.我按照这里的说明操作.当我尝试使用VS 2017中的创建新项目创建机器人应用程序时,它会出错.
无法打开项目文件.
缺少项目子类型.子模式:此安装不支持'{349c5851-65df-11da-9384-00065b846f21}'
我重新安装了vs 2017两次,但是,我收到了错误.有没有人有想法?
更新!!!
当我尝试使用命令安装MVC 5但是它给出了一个错误,说"当前环境没有解决方案打开".
Install-Package Microsoft.AspNet.Mvc -Version 5.2.4
我写了一个简单的加密/解密程序,当我解密加密文本时,它显示解密文本的grabridge值结束.我的c#代码和代码输出如下.请帮助我在没有垃圾解密后获取原文
public class CrypterText
{
static byte[] chiperbytes;
static byte[] plainbytes;
static byte[] plainKey;
static SymmetricAlgorithm desObj;
public static string encryptData(string ciperData)
{
desObj = Rijndael.Create();
plainbytes = Encoding.ASCII.GetBytes(ciperData);
plainKey = Encoding.ASCII.GetBytes("0123456789abcdef");
desObj.Key = plainKey;
desObj.Mode = CipherMode.CBC;
desObj.Padding = PaddingMode.ISO10126;
System.IO.MemoryStream ms = new System.IO.MemoryStream();
CryptoStream cs = new CryptoStream(ms, desObj.CreateEncryptor(), CryptoStreamMode.Write);
cs.Write(plainbytes, 0, plainbytes.Length);
cs.Close();
chiperbytes = ms.ToArray();
ms.Close();
return Encoding.ASCII.GetString(chiperbytes);
}
public static string decrypt() {
MemoryStream ms = new MemoryStream(chiperbytes);
CryptoStream cs = new CryptoStream(ms, desObj.CreateDecryptor(), …Run Code Online (Sandbox Code Playgroud) 我已成功编写代码,使用node.js在我的电子邮箱中阅读未见过的电子邮件.当我在普通的javascript文件中运行它时它工作正常.现在我想安排脚本每30秒运行一次.所以使用node-scheduler编写了一个代码片段,如下所示.运行这个我只是得到reading unread emails....###输出,console.log(msg);而不是打印任何东西.如果我没有nod-scheduler运行它,它工作正常.可能是什么问题?我尝试了await关键字email.unreadEmail功能,它也没有用.
我相信这是因为异步行为而发生的事情.如果有的话有办法将此代码转换为承诺吗?我有点迷惑,因为在imap接口中有多个nexted回调.
schedule.scheduleJob('*/30 * * * * *', () => {
logger.info(`scheduler runs at ${new Date()} for check unread emails`);
let email = new mail.default();
email.unreadEmail((msg) => {
console.log(msg);
});
});
Run Code Online (Sandbox Code Playgroud)
这是电子邮件阅读的代码
unreadEmail(callback){
logger.info(`reading unread emails....###`);
imap.once('ready', () => {
openIncidents((err, box) => {
if (err) throw err;
imap.search([ 'UNSEEN'], (err, results) => {
if (err) throw err;
try{
// var f = imap.fetch(results, { bodies: '',markSeen: true });
var …Run Code Online (Sandbox Code Playgroud) CREATE TABLE _Transaction (
transaction_id int,
date_time datetime default sysdatetime(),
amount real,
description varchar(500),
responsible_party varchar(50),
CONSTRAINT _transaction_pk PRIMARY KEY(transaction_id),
CONSTRAINT check_res_prty CHECK(responsible_party IN ('[ATM]','[Teller]','[Bank]','[Standing Order]','[Cheque]','[On-Line]','[Other]'))
);
CREATE TABLE _Transaction_account(
account_no int,
transaction_id int,
affect_type varchar(50),
CONSTRAINT _Transaction_account_pk PRIMARY KEY(account_no,transaction_id),
CONSTRAINT _Transaction_account_fk1 FOREIGN KEY(transaction_id) REFERENCES _transaction(transaction_id),
CONSTRAINT _Transaction_account_fk2 FOREIGN KEY(account_no) REFERENCES account(account_no),
CONSTRAINT check_affect_type CHECK(affect_type IN ('[credit]','[debit]'))
);
Run Code Online (Sandbox Code Playgroud)
我想在上面的表中写一个存储过程,它接受帐号并返回当前月份为该帐户处理的支票数.所以我写了下面的存储过程
CREATE PROCEDURE pro_check_cheques (@accountNo int)
AS
BEGIN
DECLARE @chques int
SELECT @chques=COUNT(t.responsible_party)
FROM _Transaction t JOIN _Transaction_account ta ON
ta.account_no=@accountNo AND …Run Code Online (Sandbox Code Playgroud) Date date = new Date();
DateFormat dt = new SimpleDateFormat("yyyy-MM-dd");
try {
date = dt.parse("2014-03-14");
} catch (ParseException parseException) {
}
orderBean.setDate((java.sql.Date) date);
Run Code Online (Sandbox Code Playgroud)
当我尝试使用上面的代码将 util.date 转换为 sql.date 时,会发生如下错误。我正在使用 mysql 数据库来存储数据。谁能帮我?
Mar 14, 2014 11:16:44 AM gui.salespot jButton1ActionPerformed
SEVERE: null
java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
Run Code Online (Sandbox Code Playgroud) 我有这样的问题: -
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
Run Code Online (Sandbox Code Playgroud)
为了解决这个问题,我写了一个这样的程序:
public void palindrome(){
int n=0;
for (int i = 100; i < 999; i++) { // I belive that largest palindrome is between 100 and 999
for (int j = 100; j <999; j++) {
n=i*j;
if(n>100000){
if(n/100000==n%10){
if(n/10000-(n/100000)*10==(n%100)/10){
if(n/1000-(n/10000)*10==(n%1000)/100){ …Run Code Online (Sandbox Code Playgroud) java ×4
botframework ×2
c# ×2
sql ×2
callback ×1
casting ×1
class ×1
encryption ×1
inheritance ×1
math ×1
momentjs ×1
mysql ×1
node.js ×1
promise ×1
scheduler ×1
sequelize.js ×1
sql-server ×1
subclass ×1
super ×1
superclass ×1
timestamp ×1
timezone ×1