Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8900385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:05:25+00:00 2026-06-15T01:05:25+00:00

I have two sets of code in fist i have defined custom String class

  • 0

I have two sets of code in fist i have defined custom String class and trying to create instance of it while in second i have defined custom System class and trying to create instance of it.

This is neither an interview question nor homework, i just tried it after checking this

In this I am trying to create instance of String class i have defined and i got Exception in thread "main" java.lang.NoSuchMethodError: main

public class Test {
    public static void main(String[] args) throws Exception {
        String s = new String();
        java.lang.System.out.println("done");
    }
}

class String {
    public String() {
        java.lang.System.out.println("custom String");
    }
}

In this part i am trying to create instance of System class i have defined and it worked fine

public class Test {
    public static void main(String[] args) throws Exception {
        System s = new System();
        java.lang.System.out.println("done");
    }
}
class System {
    public System(){
        java.lang.System.out.println("custom System");
    }
}

Both String and System class are final, so why there is difference in behavior??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:05:26+00:00Added an answer on June 15, 2026 at 1:05 am

    This is happening because your main is using your custom String class as argument type which is not matching with standard main method (entry point), which accepts java.lang.String[] as parameters; hence complaining.

    Change your main to use java.lang.String class as:

           public static void main(java.lang.String[] args)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two sets of code both trying to execute something like ls|grep pip
I have two data sets in google app engine datastore. class First_Set(db.Model): start_time =
I have two sets of text files. First set is in AA folder. Second
my current code is below. What I have is two sets of data phi
I have two sets of boxex on a page. 10 boxes belonging to class
I am trying to find the union of two sets with map. I have
Having some trouble with Predicates in C#. I have two sets of code (Both
I have two sets of files: PolynomialArithmetic.h/cpp and Options.h/cpp Options.h is defined as: //
I have two sets of elements with (sometimes) corresponding rel and id attributes: <a
I have two Sets. Set b is the subset of Set a . they're

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.