RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-337682

Miron's questions

Martin Hope
Miron
Asked: 2020-06-09 12:38:38 +0000 UTC

提交多个表单时如何获取相同的外部字段?

  • 0

此外,这个外部字段可以改变(一般来说,对我们来说重要的是此刻的值submit'а是相关的)。该标签form 不适合,因为它不指向 list id,而是指向 one id。
例子:

<form id="mainForm1" action="/form">
  <input type="submit"/>
</form>
<form id="mainForm2" action="/form">
  <input type="submit"/>
</form>
<input id="field" name="field"/>

您需要将字段传递id="field"给两个表单(以便submit'е每个字段都发送到服务器)

javascript
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-05-23 19:01:50 +0000 UTC

没有事务,虽然 @Transactional 注释是

  • 1

当我运行以下代码时,我得到输出false:

@Component
public class SomeNumbersMySQLDao {
    //
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
        SomeNumbersMySQLDao dao = context.getBean("someNumbersMySQLDao", SomeNumbersMySQLDao.class);
        dao.insertAnyNumber();
    }

    @Transactional(propagation = Propagation.REQUIRED) // on default
    public void insertAnyNumber() {
        System.out.println(TransactionSynchronizationManager.isActualTransactionActive());
        //
    }
    //
}

当然,交易是行不通的。required当我从带有事务的方法调用带有事务的方法never并且没有收到错误时,我理解了这一点。

内容物context.xml(SomeNumbersMySQLDao包含在包装中BP):

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context.xsd">

    <context:component-scan base-package="BP"/>

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://localhost:3306/springjdbc?serverTimezone=UTC"/>
        <property name="username" value="root"/>
        <property name="password" value="1234"/>
    </bean>
</beans>
java
  • 2 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-05-15 18:06:18 +0000 UTC

无法从spring xml上下文中的属性文件中获取属性getEnvironment

  • 0

文件内容people.properties:

knight.age=34  
knight.name=Pedro

文件内容annotationsBased.xml:

<context:property-placeholder location="classpath:people.properties"/>
<bean class="ru.miron.SOWithDocs.Entities.Person" id="knightCreatedUsingPropertiesFile">
    <constructor-arg name="age" value="${knight.age}"/>
    <constructor-arg name="name" value="${knight.name}"/>
</bean>

收到后:

ApplicationContext XMLcontext = new ClassPathXmlApplicationContext("annotationsBased.xml");
System.out.println("Knight created using properties file - " + XMLcontext.getBean("knightCreatedUsingPropertiesFile"));

输出如下:

Knight created using properties file - Person [age=34, name=Pedro]

这意味着文件中的属性已成功加载到SpEL.


为什么在下一步执行以下代码时:

System.out.println(XMLcontext.getEnvironment().getProperty("knight.age"));

结论—— null?

java
  • 2 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-05-09 14:23:23 +0000 UTC

没有可用的名为“beanName”的bean,看不到@Bean

  • 0

错误在这里:

Book warAndPiece = context.getBean("warAndPiece", Book.class);

context稍早创建一个对象(全部在 中main(String[] args)):

ApplicationContext context = new ClassPathXmlApplicationContext("instantiation.xml");

instantiation.xml包括注释:

<context:annotation-config/>

自己@Bean:

@Bean
public Book warAndPiece(@Qualifier("warAndPieceBrochure")Brochure brochure) { // it is not recommended to set qualifier as id!
    return new Book(3000, "War and Piece", "Tolstoy", brochure);
}

它在一个Book被注释为包含的类中@Bean'ы:

@Configuration
public class Book {
    ...
}

完整的错误代码:

org.springframework.beans.factory.NoSuchBeanDefinitionException:
没有名为“warAndPiece”的bean可用

乍一看,您需要的一切都已详细说明。我错过了什么?


附录:
试图@Bean在与该类相同的包中制作一个测试配置类Main:

@Configuration
public class TestBeanConf {
    @Bean
    public TestBeanConf testBean() {
        return new TestBeanConf();
    }
}

在线的

context.getBean("testBean");

引发类似的错误。

java
  • 2 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-05-09 02:25:19 +0000 UTC

如何在@Bean中获取bean?

  • 0

有以下内容@Bean:

@Bean
public Book warAndPiece() {
    return new Book(3000, "War and Piece", "Tolstoy", );
}

最后一个参数是一个对象Brochure。如果有怎么连接

  • 就像@Bean在课堂上一样Brochure(我认为调用方法不是一个好主意)
  • 和bean配置文件一样

两者都有他们的qualifier'ы

java
  • 2 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-05-03 00:47:25 +0000 UTC

在 bean 代码中为具有非空值的字段指定了 @Qualifier,但在对象容器中的程序执行期间该字段为空

  • 0

配置:

<bean class = "java.lang.String">
    <qualifier value = "db_name"/>
    <constructor-arg value = "db_name_using_bean_with_qualifier"/>
</bean>
<bean id = "any_project" class="ru.miron.Annotations.Database"/>

类Database:

public class Database {
    @Autowired(required = true) // true on_default
    @Qualifier("db_name") // name of bean to search
    private String name;

    ...

    public void print() {
        System.out.println("db name: " + name);
    }

}

可执行代码:

Database dbFromConfigUsingQualifiers = context.getBean("any_project", Database.class);
dbFromConfigUsingQualifiers.print();

预期输出:

数据库名称:db_name_using_bean_with_qualifier

在实践中:

数据库名称:空

没有错误。这意味着它被qualifier'у bean. 但是它是如何发现一些bean重要的东西并null取而代之的——我永远不会知道

java
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-03-09 15:16:10 +0000 UTC

当我尝试设置 UNION 操作优先级时出现语法错误

  • 1
SELECT
    id
FROM
    sellers
WHERE
    city = 'San Jose'

UNION

(SELECT
    id
FROM
    customers
WHERE
    city = 'San Jose'

UNION ALL

SELECT
    id
FROM
    deals
WHERE
    dealDate LIKE '____-03-10');

给出错误消息:

错误代码:1064。检查与您的 MySQL 服务器版本相对应的手册,以在第 10 行的 '(SELECT id FROM customers WHERE city = 'San Jose' UNION ALL SELECT id ' 附近使用正确的语法

事实是,SELECT'ы一切都完美地返回。即使有了这个条目,一切正常:

SELECT
    id
FROM
    sellers
WHERE
    city = 'San Jose'

UNION

SELECT
    id
FROM
    customers
WHERE
    city = 'San Jose'

UNION ALL

SELECT
    id
FROM
    deals
WHERE
    dealDate LIKE '____-03-10';

但是,不幸的是,已经没有我想要设置的联合优先级(q1 UNION(q2 UNION ALL q3))。
如何正确设置应用操作的优先级UNION?

mysql
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-03-07 13:40:07 +0000 UTC

与数字 0.1 的比较操作无法正常工作

  • 1

这是请求:

SELECT id, city, commision FROM sellers
WHERE commision > 0.1;

这是输出:

id city Commission
'1', 'London', '0.12'
'2', 'San Jose', '0.13'
'3', 'New York', '0.1'
'4', 'London', '0.11'
' 7', '巴塞罗那', '0.15'

输出中有一行的列值commition等于0.1,尽管在WHERE我写的时候我只需要具有commition > 0.1.
键入commition- FLOAT。而且,有趣的是,其他数字没有观察到这一点。例如,请求时:

SELECT id, city, commision FROM sellers
WHERE commision > 0.12;

我们得到输出:

“7”、“巴塞罗那”、“0.15”、
“2”、“圣何塞”、“0.13”

也就是说,'1', 'London', '0.12'应该跳过具有列值的行。

mysql
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-01-26 14:11:42 +0000 UTC

函数的返回类型(基于类数据)必须可以转换为其他几种类型。如何构建正确的架构?

  • 0

让我们以仅知道该函数所在的类的类型就可以将函数的返回类型转换为其他类型为基础,因为函数的返回类型直接取决于执行的计算在解析过程中。
下面的解决方案立刻浮现在脑海:创建一个解析器类,其中有许多解析函数,可以将函数的返回类型转换为其他类型。但是可以通过没有方法的接口仅表明这是一个解析器。然后整个抽象崩溃了——我们开始依赖特定的实现。如何进行?可能是我一开始建的系统不正确,这个问题是根治不了的?

如果需要,这里是程序的文本:

public interface Crashable<OutputType, ToBreakDeterminator> {
    boolean hasCrushed();
    default boolean canBreakDown(CrasherUI<OutputType, ToBreakDeterminator> crasher) { // проверять должен CrasherUI.canCrash()!
        return crasher.canCrash(this);
    }
    OutputType breakDown(CrasherUI<OutputType, ToBreakDeterminator> crasherUI) throws IllegalStateException;
    ToBreakDeterminator getToBreakDeterminator();   
}

public class Thing implements Crashable<String, Integer>{
    private Integer rigidity;
    private String name;

    private CrasherUI crushedBy;

    public final static Integer DEFAULT_RIGIDITY = 50;
    public final static String DEFAULT_NAME = "unnamed";

    {
        crushedBy = null;
    }

    //...

    @Override
    public String breakDown(CrasherUI<String, Integer> crasher) throws IllegalStateException {
        if(hasCrushed()) {
            throw new IllegalStateException("It is already crushed by " + crushedBy);
        }
        crushedBy = crasher;
        return "u broke " + name + " with " + rigidity + " by " + crasher + ", dude"; 
        // это возврат ф-ции. По-идее должен возвращать уже OutputType(см абстрактный класс)
    }

    //...
}

这是抽象类本身:

public abstract class AbstractApartaments<OutputType, InputType, ToBreakDeterminator> implements ApartamentUI{
    private Stack<? extends Crashable<InputType, ToBreakDeterminator>> things;

    private CrasherUI<InputType, ToBreakDeterminator> crasher;

    private Function<InputType, OutputType> inputToOutput; // один тип(Crashable) только обрабатывать можем. 
    private ConcurrentLinkedQueue<OutputType> toUserOutputs;
    private ToUserOutputUI<OutputType> out;

    {
        things = new Stack();
        toUserOutputs = new ConcurrentLinkedQueue();
    }

    public AbstractApartaments(Collection<? extends Crashable<InputType, ToBreakDeterminator>> toCrush, CrasherUI<InputType, ToBreakDeterminator> crasher, Function<InputType, OutputType> inputToOutput, ToUserOutputUI<OutputType> out){
        things.addAll(toCrush); // Ошибка!
        this.crasher = crasher;
        this.inputToOutput = inputToOutput;
        this.out = out;
    }


    @Override
    public boolean hasThingsToCrash() {
        return things.isEmpty();
    }

    @Override
    public boolean crashNext() {
        if(!things.isEmpty()) {
            Crashable<InputType, ToBreakDeterminator> toCrash = things.pop();
            if(toCrash.canBreakDown(crasher)) {
                toUserOutputs.add(inputToOutput.apply(toCrash.breakDown(crasher)));
                return true;
            } else {
                return false;
            }
        } else {
            throw new NoSuchElementException();
        }
    }

    @Override
    public void pullToUserOutputs() {
        while(!toUserOutputs.isEmpty()) {
            out.toOutput(toUserOutputs.poll());
        }
    }

}
java
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-01-23 21:12:30 +0000 UTC

是否可以以某种方式仅指定泛型的一部分?我怎样才能改变架构来解决这个问题?

  • 0

有如下界面(是的,我知道可以更换Function<T, V>,不是重点):

public interface OutputUI<T, V> {
    void addOutput(T t);
    V getCalculatedOutput();
}

在将新对象发送到输出(之前转换它)时,我在另一个类中使用此接口。在这个其他类中,我根本不关心类型V:

public OutputUI breakDown(){
    out.addOutput("u broke " + name + " with " + rigidity + ", dude");
    return out;
}

当你收到它时,它也不重要。

首先想到的是制作两个独立的接口 -Input<T>和Output<V>.

但是还有其他方法吗?特别是,是否可以仅指定工作所需的泛型?

java
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-12-28 17:08:28 +0000 UTC

自动完成不起作用

  • 0

我按照指南做了一切:

在此处输入图像描述

点功能后不提示:

在此处输入图像描述

但是,我注意到,当按下时,会ctrl + space弹出以下内容:

在此处输入图像描述

要“达到”这些功能,您需要再按ctrl + space几次:

在此处输入图像描述

我怀疑关键在于它提供了列表中的内容,只需一次 poke 即可调用ctrl + space。

eclipse
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-12-21 23:52:33 +0000 UTC

HashMap<K, V> 类的 resize() 方法的这个片段中是否需要按位乘法?

  • 1

关于这段代码:

newTab[e.hash & (newCap - 1)] = e;

我们知道它capacity HashMap'а总是 2 的倍数。因此,表达式的结果newCap - 1将表示一组二进制表示的单元。然后这个结果和小于这个结果的给定数的按位乘法运算(对于给定值在 中观察到HashMap)等于这个数。
例子:

(64 - 1) & 51

  111111
* 110011
  ------
  110011

110011 = 51.

那为什么要执行这个操作:

e.hash & (newCap - 1)

如果可以用这个代替:

e.hash

resize()这是理解上下文的方法的源代码。

/**
 * Initializes or doubles table size.  If null, allocates in
 * accord with initial capacity target held in field threshold.
 * Otherwise, because we are using power-of-two expansion, the
 * elements from each bin must either stay at same index, or move
 * with a power of two offset in the new table.
 *
 * @return the table
 */
final Node<K,V>[] resize() {
    Node<K,V>[] oldTab = table;
    int oldCap = (oldTab == null) ? 0 : oldTab.length;
    int oldThr = threshold;
    int newCap, newThr = 0;
    if (oldCap > 0) {
        if (oldCap >= MAXIMUM_CAPACITY) {
            threshold = Integer.MAX_VALUE;
            return oldTab;
        }
        else if ((newCap = oldCap << 1) < MAXIMUM_CAPACITY &&
                 oldCap >= DEFAULT_INITIAL_CAPACITY)
            newThr = oldThr << 1; // double threshold
    }
    else if (oldThr > 0) // initial capacity was placed in threshold
        newCap = oldThr;
    else {               // zero initial threshold signifies using defaults
        newCap = DEFAULT_INITIAL_CAPACITY;
        newThr = (int)(DEFAULT_LOAD_FACTOR * DEFAULT_INITIAL_CAPACITY);
    }
    if (newThr == 0) {
        float ft = (float)newCap * loadFactor;
        newThr = (newCap < MAXIMUM_CAPACITY && ft < (float)MAXIMUM_CAPACITY ?
                  (int)ft : Integer.MAX_VALUE);
    }
    threshold = newThr;
    @SuppressWarnings({"rawtypes","unchecked"})
    Node<K,V>[] newTab = (Node<K,V>[])new Node[newCap];
    table = newTab;
    if (oldTab != null) {
        for (int j = 0; j < oldCap; ++j) {
            Node<K,V> e;
            if ((e = oldTab[j]) != null) {
                oldTab[j] = null;
                if (e.next == null)
                    newTab[e.hash & (newCap - 1)] = e;
                    //Эта строка!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                else if (e instanceof TreeNode)
                    ((TreeNode<K,V>)e).split(this, newTab, j, oldCap);
                else { // preserve order
                    Node<K,V> loHead = null, loTail = null;
                    Node<K,V> hiHead = null, hiTail = null;
                    Node<K,V> next;
                    do {
                        next = e.next;
                        if ((e.hash & oldCap) == 0) {
                            if (loTail == null)
                                loHead = e;
                            else
                                loTail.next = e;
                            loTail = e;
                        }
                        else {
                            if (hiTail == null)
                                hiHead = e;
                            else
                                hiTail.next = e;
                            hiTail = e;
                        }
                    } while ((e = next) != null);
                    if (loTail != null) {
                        loTail.next = null;
                        newTab[j] = loHead;
                    }
                    if (hiTail != null) {
                        hiTail.next = null;
                        newTab[j + oldCap] = hiHead;
                    }
                }
            }
        }
    }
    return newTab;
}
java
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-12-19 20:10:43 +0000 UTC

向 ArrayList 添加元素的机制是什么?

  • 6

这个过程在内部是如何安排的ArrayList?我想知道实施细节。它是如何作用于价值观的?特别是grow().

java
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-12-17 21:26:04 +0000 UTC

OutputStreamWriter 和 FileWriter 有什么区别?

  • 2

老实说用谷歌搜索。发现这个:OutputStreamWriter vs FileWriter。答案一般谈论 XXXInputStream 和 XXXOutputStream 之间的区别(虽然这很有帮助,但这不是我需要的)。
从第二个链接来看:OutputStream、BufferedWriter 和 FileWriter 的区别。我也没有找到答案。

本质上:
这是完整的类代码:

public class FileWriter extends OutputStreamWriter {
    public FileWriter(String fileName) throws IOException {
        super(new FileOutputStream(fileName));
    }

    public FileWriter(String fileName, boolean append) throws IOException {
        super(new FileOutputStream(fileName, append));
    }

    public FileWriter(File file) throws IOException {
        super(new FileOutputStream(file));
    }

    public FileWriter(File file, boolean append) throws IOException {
        super(new FileOutputStream(file, append));
    }

    public FileWriter(FileDescriptor fd) {
        super(new FileOutputStream(fd));
    }

    public FileWriter(String fileName, Charset charset) throws IOException {
        super(new FileOutputStream(fileName), charset);
    }

    public FileWriter(String fileName, Charset charset, boolean append) throws IOException {
        super(new FileOutputStream(fileName, append), charset);
    }

    public FileWriter(File file, Charset charset) throws IOException {
        super(new FileOutputStream(file), charset);
    }
    public FileWriter(File file, Charset charset, boolean append) throws IOException {
        super(new FileOutputStream(file, append), charset);
    }
}

它绝对实现了所有构造函数OutputStreamWriter。它并没有添加任何新内容。我很困惑。

java
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-12-15 22:22:52 +0000 UTC

ByteArrayInputStream 和 ByteArrayOutputStream 有什么区别?

  • 1

似乎您可以同时写入两者,似乎您可以从两者中读取。他们有什么区别?

java
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-12-13 23:47:29 +0000 UTC

如何一次同步多个对象?

  • 2

一个对象要同步?是的,请!

Object object = new Object();
synchronized(object) {
    // действия с ним
}

而且,在这里,如何同步某个对象列表?不要写成相互嵌套的同一套synchronized。

java
  • 2 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-12-09 22:42:27 +0000 UTC

Arrays.stream() 和 Stream.of() 之间的根本区别是什么?

  • 0

我读到 Stream.of() 调用 Arrays.stream(),除此之外它还能做什么?
在处理以下相同示例时,我没有注意到任何差异:

Stream<Person> arraysStream = Arrays.stream(new Person[] {town.get(0)});
Stream<Person> streamOf= Stream.of(new Person[] {town.get(0)});
методы
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-11-09 17:23:04 +0000 UTC

关于工厂本质的问题

  • 1

是否真的应该只在创建新对象时才使用工厂,需要考虑到以前的对象、工厂内部变量和外部变量?

我举个例子:

interface Zone{
    Enemy toCreate(String name);
}
class Zone101 implements Zone{
    final int enemyToIncreaseTheirDifficult = 3;
    int countOfCreatedEnemies = 0;
    int difficult = 0;

    public Enemy toCreate(String name) {
        if(name.equals("Zombie")) {
            if(countOfCreatedEnemies % enemyToIncreaseTheirDifficult == 0) {
                difficult++;
            }
            countOfCreatedEnemies++;
            return new Zombie(difficult);

        }else {
            return null;
        }
    }
}
class Enemy{
    private int difficult;

    Enemy(int difficult){
        this.difficult = difficult;
    }
}
class Zombie extends Enemy{
    int timesToReLife;

    Zombie(int difficult){
        super(difficult);
        timesToReLife = difficult + 1;
    }
}
ооп
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-11-04 14:30:54 +0000 UTC

java文档中带有空字符串的“误解”

  • 0

8.1 空行

在以下情况下应始终使用一个空行:

1) 方法之间

2)方法中的局部变量与其第一条语句之间

3)在块(见第 5.1.1 节)或单行(见第 5.1.2 节)注释之前

4) 方法内部的逻辑部分之间以提高可读性

空行就是这个意思:

int x;
//Новая строка(blank line)
int y;

那么如何理解它:“方法中的局部变量与其第一个定义之间”(我希望是正确的翻译)?

这是文档中的一条规则:

如果初始值与首先执行的计算无关,则局部变量必须在声明它们的地方进行初始化。

所以现在我们确定它采用以下形式:

int x; // в начале метода 
//код 
x = r/2*9; //где r вычисляется в коде( /2*9 - для примера)

那么空行呢?我应该在代码块和第一次初始化之间插入它吗?

java
  • 1 个回答
  • 10 Views
Martin Hope
Miron
Asked: 2020-05-18 00:47:35 +0000 UTC

接口——它们的问题与抽象类问题的相似性

  • 1

如您所知,接口和抽象类之间的区别在于创建变量的可能性(仅用于接口的最终静态)和接口的多重继承的可能性。
Java 8 更新几乎抹去了这条线,只留下了上述限制。这是否意味着现在具有默认方法的接口与类有相同的痛处?

PS:这里是疮的列表:

使用继承的危险:

  1. 我们可能没有意识到,被覆盖的方法可能会在另一个超类方法中被调用,从而导致计算错误。一个典型的例子是创建一个将元素添加到 HashSet 的调用计数器 -

     class InstrumentedHashSet extends HashSet{
      private int addCount = 0;
      //Пропуск конструктора. Перейдем к сути
      //…
      public boolean add(Object o){
           addCount++;
           super.add(o);
       }
       public boolean addAll(Collection c){
           addCount+=c.size();
           super.addAll(c);
       }  
       //… Другие методы
     }
    

    InstrumentedHashSet,然后我们添加集合的大小,调用HashSet的addAll()方法,里面包含了add()方法。反过来,它调用重写的方法!结果,我们将得到一个比预期大 2 倍的数字。这种“使用自己”是一个实现细节,不能保证它不会从一个版本更改为另一个版本。这可以通过简单地循环调用 add() 来改变,但这是代码重复,通常 - 你可能会错过一些东西。此选项复杂、耗时且容易出错。

  2. 新版本中的超类可能有一些方法。假设我们有一个安全系统。我们有一个控制新元素添加的子类(重新定义方法,检查元素是否符合其中的一些规范)。一个新方法出现了,它有一个字符串,直接添加字符串。底线:保护有漏洞,系统可以被黑客入侵。

  3. 如果超类有一个在子类之一中的方法,那么,充其量,当参数不匹配时,程序将无法编译。在最坏的情况下,我们只会得到错误的结果,不知道错误在哪里。

  4. 超类中的任何缺陷都将转移到子类的 API 中,而组合允许开发隐藏这些缺陷的新 API。因此,您必须仔细考虑实施和结构,因为只有一次机会改变某些东西。有必要尝试不同的结构变体,实现。

//единственная болячка, которая не переходит:

  1. 我们可能会意外地继承一个根本不是为此而设计的类,要么没有记录继承,要么根本没有记录。解决方案是使此类类成为最终类,以使其不能被继承。顺便说一句,这将稍微提高速度。
java
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5