Page 3 of 3 FirstFirst 123
Results 41 to 60 of 60
Like Tree1Likes

Thread: need program logic

  1. #41
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,814
    Rep Power
    19

    Default Re: need program logic

    Honestly, where do you think it goes?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  2. #42
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,348
    Blog Entries
    7
    Rep Power
    20

    Default Re: need program logic

    As far as I can see now, nowhere in particular; why ask?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #43
    anonymouss is offline Member
    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0

    Default Re: need program logic

    Quote Originally Posted by Tolls View Post
    Honestly, where do you think it goes?
    that is iam trying to ask if anyone know tell me,i know manually how the program executes and sorting the numbers i l say,as a interpreted how the process will go,because java doesnot execute line by line

  4. #44
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,348
    Blog Entries
    7
    Rep Power
    20

    Default Re: need program logic

    Quote Originally Posted by anonymouss View Post
    that is iam trying to ask if anyone know tell me,i know manually how the program executes and sorting the numbers i l say,as a interpreted how the process will go,because java doesnot execute line by line
    Indeed it doesn't and it is all very well explained in the turorials you were pointed at; there is no need to regurgitate it all here, in this forum.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #45
    anonymouss is offline Member
    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0

    Default Re: need program logic

    Quote Originally Posted by JosAH View Post
    Indeed it doesn't and it is all very well explained in the turorials you were pointed at; there is no need to regurgitate it all here, in this forum.

    Jos
    which topic the execution process ?you dont know about this

  6. #46
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,348
    Blog Entries
    7
    Rep Power
    20

    Default Re: need program logic

    Quote Originally Posted by anonymouss View Post
    which topic the execution process ?you dont know about this
    Oh please ...

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #47
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    925
    Rep Power
    2

    Default Re: need program logic

    Unsubcribing from this topic. It makes me rage :)

  8. #48
    anonymouss is offline Member
    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0

    Default Re: need program logic

    whats the error in the program
    Java Code:
        class Myclass  
        {  
        public static void main(String args[]);  
        {  
            class AX  
            {  
            public int a=10;  
            Ax obj=new AX();  
            System.out.println(obj.a);  
            }  
        }  
          
        }
    Myclass.java:9: <identifier> expected
    System.out.println(obj.a);
    ^
    Myclass.java:9: <identifier> expected
    System.out.println(obj.a);
    ^
    2 errors

  9. #49
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,814
    Rep Power
    19

    Default Re: need program logic

    You can't declare a class inside a method.
    This is basic stuff.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #50
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,348
    Blog Entries
    7
    Rep Power
    20

    Default Re: need program logic

    Quote Originally Posted by Tolls View Post
    You can't declare a class inside a method.
    This is basic stuff.
    s/class in/statement out/

    local classes are allowed ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  11. #51
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,814
    Rep Power
    19

    Default Re: need program logic

    Good lord.
    Though I can understand why I've never seen that used...it just looks soooo wrong.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  12. #52
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,348
    Blog Entries
    7
    Rep Power
    20

    Default Re: need program logic

    Quote Originally Posted by Tolls View Post
    Good lord.
    Though I can understand why I've never seen that used...it just looks soooo wrong.
    It is, sort of ... we all do define and instantiate anonymous classes in methods all the time but defining a class with a name seems 'too big' in the scope of a single method; maybe those lambda closures make them look less fat because there's not much against the definition of local, named classes except for their 'bulky' look.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  13. #53
    anonymouss is offline Member
    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0

    Default Re: need program logic

    Quote Originally Posted by JosAH View Post
    s/class in/statement out/

    local classes are allowed ...

    kind regards,

    Jos
    i mean is it not local class,which it refers we can declare in a method,can anyone tell me clearly
    Last edited by anonymouss; 05-03-2013 at 08:48 AM.

  14. #54
    anonymouss is offline Member
    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0

    Default Re: need program logic

    Quote Originally Posted by JosAH View Post
    s/class in/statement out/

    local classes are allowed ...

    kind regards,

    Jos
    so statements should be provide outside of the local class am i correct

  15. #55
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,348
    Blog Entries
    7
    Rep Power
    20

    Default Re: need program logic

    Quote Originally Posted by anonymouss View Post
    so statements should be provide outside of the local class am i correct
    Yes, statements don't belong in a local class becaus they're very global oriented. They might even break out of a local class at night and spread themselves over global public classes and disguise themselves as innocent looking if-statements or simple increment operators; you won't recognize them anymore; terrible, better leave the lights on and the fridge closed at night ...

    Do you know what the acronym 'rtfm' means?

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  16. #56
    anonymouss is offline Member
    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0

    Default Re: need program logic

    Quote Originally Posted by JosAH View Post
    Yes, statements don't belong in a local class becaus they're very global oriented. They might even break out of a local class at night and spread themselves over global public classes and disguise themselves as innocent looking if-statements or simple increment operators; you won't recognize them anymore; terrible, better leave the lights on and the fridge closed at night ...

    Do you know what the acronym 'rtfm' means?
    Jos
    Read The Flipping Manual, i studied about local classes in java tutorial but i didnt found that kind of information,now i got it,even final or abstract modified can be declared in local classses right?
    Last edited by anonymouss; 05-05-2013 at 08:16 AM.

  17. #57
    anonymouss is offline Member
    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0

    Default Re: need program logic

    waiting for reply

  18. #58
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,348
    Blog Entries
    7
    Rep Power
    20

    Default Re: need program logic

    Quote Originally Posted by anonymouss View Post
    waiting for reply
    w.r.t. your post #54: no, you are not correct.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  19. #59
    anonymouss is offline Member
    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0

    Default Re: need program logic

    Quote Originally Posted by JosAH View Post
    w.r.t. your post #54: no, you are not correct.

    Jos
    why,you only mentioned statments should be out

  20. #60
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,814
    Rep Power
    19

    Default Re: need program logic

    Code needs to be in a code block.
    A code block is either a static block inside a class, or a method inside a class.
    The only thing allowed outside that (but inside a class) are attribute declarations, which can also be initialised at the same time.

    You can (apparently) declare a class virtually anywhere.

    Now, if you're still confused then you need to sit down with a decent book and work through the examples.
    Don't ask if x,y or z is correct...try and compile it first, and if it doesn't compile then clearly it isn't correct.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Page 3 of 3 FirstFirst 123

Similar Threads

  1. Replies: 11
    Last Post: 02-01-2013, 11:47 PM
  2. how is the logic this program???
    By riris in forum New To Java
    Replies: 4
    Last Post: 03-16-2012, 05:38 PM
  3. Need help on this program logic
    By cotemaria in forum New To Java
    Replies: 1
    Last Post: 11-12-2011, 09:14 PM
  4. need help in merging GUI and logic main program
    By lavender88 in forum NetBeans
    Replies: 2
    Last Post: 04-02-2011, 01:28 PM
  5. Separating program logic and GUI
    By loopingman in forum AWT / Swing
    Replies: 0
    Last Post: 12-08-2008, 02:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •