{"id":21662844,"url":"https://github.com/urunov/thinking-in-java","last_synced_at":"2025-03-20T05:49:01.676Z","repository":{"id":122920401,"uuid":"446440255","full_name":"Urunov/Thinking-in-Java","owner":"Urunov","description":"Thinking in Java by Bruce Eckel","archived":false,"fork":false,"pushed_at":"2022-02-14T17:11:04.000Z","size":198,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-25T07:27:33.331Z","etag":null,"topics":["java","object-oriented","object-oriented-programming","objectmodel","oop","oops-in-java","thinkinginjava"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Urunov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-10T13:45:12.000Z","updated_at":"2022-03-16T18:03:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"07e5682d-8f04-40d9-88c0-b2236a4f9995","html_url":"https://github.com/Urunov/Thinking-in-Java","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Urunov%2FThinking-in-Java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Urunov%2FThinking-in-Java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Urunov%2FThinking-in-Java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Urunov%2FThinking-in-Java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Urunov","download_url":"https://codeload.github.com/Urunov/Thinking-in-Java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244560373,"owners_count":20472219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","object-oriented","object-oriented-programming","objectmodel","oop","oops-in-java","thinkinginjava"],"created_at":"2024-11-25T10:18:20.858Z","updated_at":"2025-03-20T05:49:01.671Z","avatar_url":"https://github.com/Urunov.png","language":"Java","readme":"# Thinking-in-Java\n  Go to the Resource: Thinking in Java by Bruce Eckel [link](http://www.dblab.ntua.gr/~gtsat/collection/Java%20books/Bruce.Eckel.Thinking.In.Java.4th.Edition.Dec.2007.eBook-BBL.pdf)\n\n                  [Most of selected example source code in here selected to the real-projects]\n                  \n                  \n### 1. Introduction to Objects\n\n    1.1 The progress of abstraction\n    \n     | All programming languages provide abstractions. \n     | It can be argued that the complexity of the problems you’re able to solve is directly related to the kind\n     | and quality of abstraction.\n    \n      \n     \n  --\n### 2. Everything is an Object\n\n  An object has state, behavior and identity.\n        \n  The tellers, customers, accounts, transactions, etc., can each be represented with a unique entity in the computer program.\n  This entity is the object, and each object belongs to a particular class that defines its characteristics and behaviors.\n\n  There needs to be a way to make a request of the object so that it will do something, such as complete a transaction, draw something on the screen,\n  or turn on a switch. And each object can satisfy only certain requests. The requests you can make of an object are defined by its interface,\n  and the type is what determines the interface. A simple example might be a representation of a light bulb:\n\n\n\u003cimg width=\"720\" alt=\"Screen Shot 2022-01-11 at 12 24 41 AM\" src=\"https://user-images.githubusercontent.com/11626327/148791691-4ae9b651-d9a0-4d5c-9753-1933f685e3c5.png\"\u003e\n\n \u003cb\u003e Java uses three explicit keywords to set the boundaries in a class: public, private, and protected. \u003c/b\u003e\n  \n \u003cb\u003e \u003cu\u003e public means the following element is available to everyone. \u003c/u\u003e \u003c/b\u003e\n \n \u003cb\u003e The private keyword, on the other hand, means that no one can access that element except you, \u003c/b\u003e the creator of the type, inside methods of that type.\n private is a brick wall between you and the client programmer. \n \n Someone who tries to access a private member will get a compile-time error. \n \n \u003cb\u003e The protected keyword acts like private, with the exception that an inheriting class has access to protected members, but not private members. \u003c/b\u003e\n\n ### 2.1 Reusing the implementation\n  Code reuse is one of the greatest advantages that \u003cb\u003e object-oriented programming \u003c/b\u003e languages provide.\n\n You are composing a new class from existing classes, this concept is called composition (if the composition happens dynamically, \n it’s usually called aggregation).\n Composition is often referred to as a “has-a” relationship, as in “A car has an engine.”\n\n\u003cimg width=\"394\" alt=\"Screen Shot 2022-01-11 at 12 44 29 AM\" src=\"https://user-images.githubusercontent.com/11626327/148794723-90252d0c-39cf-4727-a12a-5864a9b5ea71.png\"\u003e\n\n### Interchangeable objects with polymorphism\n\n  \u003cb\u003e Java also has numerous containers in its standard library. \u003c/b\u003e\n\nIn some libraries, one or two generic containers is considered good enough for all needs, \nand in others (Java, for example) the library has different types of containers for different needs: \n\n \u003e\u003e several different kinds of \u003cb\u003e List classes (to hold sequences) \u003c/b\u003e,\n    \u003cb\u003e Maps (also known as associative arrays, to associate objects with other objects)\u003c/b\u003e, \n\n  \u003cb\u003e Sets (to hold one of each type of object), and more components such as queues, trees, stacks, etc. \u003c/b\u003e\n  \nThere are two reasons that you need a choice of containers. First, containers provide different types of interfaces and external behavior.\n\n\u003cb\u003e A stack has a different interface and behavior than a queue\u003c/b\u003e, which is different from a set or a list.\nOne of these might provide a more flexible solution to your problem than the other. \n\nSecond, different containers have different efficiencies for certain operations.\nFor example, there are two basic types of List: ArrayList and LinkedList. \nBoth are simple sequences that can have identical interfaces and external behaviors. But certain operations can have significantly different costs. \n\nRandomly accessing elements in an ArrayList is a constant-time operation; it takes the same amount of time regardless of the element you select. \n\nHowever, in a \u003cb\u003e  LinkedList \u003c/b\u003e it is expensive to move through the list to randomly select an element, and it takes longer to find an element that is farther down the list. \nOn the other hand, if you want to insert an element in the middle of a sequence, \n\nYou might start building your program with a LinkedList and, when tuning for performance, change to an ArrayList.\nBecause of the abstraction via the interface List, you can change from one to the other with minimal impact on your code.\n\n### Relational operators\n\nRelational operators generate a boolean result. They evaluate the relationship between the values of the operands.\n\nA relational expression produces true if the relationship is true, and false if the relationship is untrue. The relational operators are less than (\u003c), greater than (\u003e), **less than or equal to (\u003c=), greater than or equal to (\u003e=), equivalent (==) and not equivalent (!=). **\n\n\nEquivalence and nonequivalence work with all primitives, but the other comparisons won’t work with type boolean. Because boolean values can only be true or false, “greater than” and “less than” doesn’t make sense.\n\n      //: operators/Equivalence.java\n          public class Equivalence {\n            public static void main(String[] args) {\n              Integer n1 = new Integer(47);\n              Integer n2 = new Integer(47);\n              System.out.println(n1 == n2);\n              System.out.println(n1 != n2);\n            }\n          } /* Output:\n          false\n          true\n          *///:~\n\n### The static keyword.\n\nYou can achieve both of these effects with the \u003cb\u003e static keyword\u003c/b\u003e. \n\n\n\n### 3. Operators\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furunov%2Fthinking-in-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furunov%2Fthinking-in-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furunov%2Fthinking-in-java/lists"}