Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Java compile time Errors

Java compile time Errors

Scheduled Pinned Locked Moved Java
java
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pruthivi_Dev
    wrote on last edited by
    #1

    import java.util.*;
    class One
    {
    static String city;
    public static void main(String args[])
    {
    city=args[0];
    Two t= new Two();
    }
    }
    class Two extends One
    {
    if(city=="Banglore")
    Two()
    {
    System.out.println("Hello BANGLORE");
    }
    }

    Richard DeemingR M M 3 Replies Last reply
    0
    • P Pruthivi_Dev

      import java.util.*;
      class One
      {
      static String city;
      public static void main(String args[])
      {
      city=args[0];
      Two t= new Two();
      }
      }
      class Two extends One
      {
      if(city=="Banglore")
      Two()
      {
      System.out.println("Hello BANGLORE");
      }
      }

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Good job the error is blindingly-obvious, since you didn't bother to tell us what error you're getting! :doh:

      Member 13451299 wrote:

      class Two extends One
      {
      if(city=="Banglore")

      You can't put an if statement directly inside a class. It has to be in a method. The Java™ Tutorials[^]


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      • P Pruthivi_Dev

        import java.util.*;
        class One
        {
        static String city;
        public static void main(String args[])
        {
        city=args[0];
        Two t= new Two();
        }
        }
        class Two extends One
        {
        if(city=="Banglore")
        Two()
        {
        System.out.println("Hello BANGLORE");
        }
        }

        M Offline
        M Offline
        Manish K Agarwal
        wrote on last edited by
        #3

        :)

        import java.util.*;
        class One
        {
        public static String city;
        public static void main(String args[])
        {
        city=args[0];
        Two t= new Two();
        }
        }

        class Two extends One
        {
        public Two()
        {
        if(city=="Banglore")
        System.out.println("Hello BANGLORE");
        }
        }

        1 Reply Last reply
        0
        • P Pruthivi_Dev

          import java.util.*;
          class One
          {
          static String city;
          public static void main(String args[])
          {
          city=args[0];
          Two t= new Two();
          }
          }
          class Two extends One
          {
          if(city=="Banglore")
          Two()
          {
          System.out.println("Hello BANGLORE");
          }
          }

          M Offline
          M Offline
          Member 13468882
          wrote on last edited by
          #4

          Very Goooddd! [^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups