Can you write a class, also called java.lang.String?

Source: Internet
Author: User
OK, but when applied, it needs to be loaded with its own classloader, otherwise the system ClassLoader will always just go
Load the java.lang.String in the Jre.jar package. Because in Tomcat's Web application, it's made up of WebApp
Your class loader will first load the class in the Web-inf/classess directory, and then delegate the class loader to the superior
Download, if we write a java.lang.String in Tomcat's Web application, the Servlet program adds
It's the java.lang.String we write ourselves, but there are a lot of potential problems that can be used.
The Java.lang.String class will have problems.
Although Java provides endorsed technology, you can overwrite certain classes in the JDK, specifically ... However, to
The overridden class is a restricted range, excluding classes in packages such as Java.lang.


public class String {
public static void Main (string[] args) {
System.out.println ("stirng");
}
}


The error is as follows:

Error: The main method cannot be found in the class a_stringtest.string, define the Main method as:
public static void Main (string[] args)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.