Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

  • Re: General CS concepts

    To clarify some points above I here have two classes which will look really stupid.

    Both of them are valid syntax and they show that you can use certain symbols as variable names as well as class names. It also shows you that you can create a final instance member without setting it straight away, but you HAVE to set it in the constructor or in an instance block but like above, you can only set it ONCE.

    Now for the freaky stuff.

    CAUTION: This is not best practise, DO NOT do this when programming

    public class _ {
     
        public int _ = 0;
     
        public final int __;
     
        public _() {
            this._++;
            this.__ = 5;
        }
     
        public static void main(final String... arguments) {
            final _ _ = new _();
            System.out.println("_ = " + _._);
        }
    }


    public class $ {
     
        public final int ;
     
        public int $ = 0;
     
        public $() {
            this.$++;
            this. = 5;
        }
     
        public static void main(String... arguments) {
            final $ $ = new $();
            System.out.println("$ = " + $.$);
        }
    }

    And also the conclusion to the post above this one is that all Java developers are farmers

    Happy coding! Enjoy!

    // Json
    General CS concepts helloworld922
    1
    1. ganesh -
      try to learn new concept don't try to find out errror in java language . this language full sartsifed your requirement.......