Why doesn't the java subclass inherit the parameterized constructor of the parent class?

the constructor with String of the JFrame class is obviously public, so why not inherit it to the subclass?

import javax.swing.*;

public class test extends JFrame
{    
    public test() {
        // TODO 
    }
    public static void main(String[] args) {
        JFrame frame=new test("123");
    }
    
}
Mar.12,2021

The constructor in the

parent class is inherited, but the subclass calls its own implicit constructor by default when it creates the object. If you want to use the parent constructor, override

with the constructor of the parent class
yourself.
import javax.swing.JFrame;

public class test extends JFrame
{    
    public test(String title) {
        // TODO 
        super(title);
    }
    public static void main(String[] args) {
        JFrame frame=new test("123");
    }
}
< hr > The

public-modified class means that this class can be opened to the public, other classes can inherit it, and the object can be instantiated externally.

if you don't add public, the default modifier is protected, for open only to the same package.


Why is your class name lowercase? did the compiler report no error

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ba69-412f0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ba69-412f0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?