Tutor profile: Aakash A.
Subject: Web Development
Subject: Computer Science (General)
I do not entirely understand what the difference is between and object and a class in object oriented program. I was wondering if you could help me understand the difference and the reason that both exist.
Sure! Just from a broad perspective, a "class" can be considered a blueprint or template from which "objects" are created. For example, if a building was an "object", the blueprint that was used to design that building is the "class". Classes are meant to group same kinds of objects whereas objects represent single entities in the real word (ie. a "car" could be a class but "Tesla", "Honda", "Toyota" could all be objects). Classes are only declared once whereas Objects can be repeatedly created. Those are the core differences between classes and objects. Now, to answer your second question, "Why do both exist?" The reason is, they both serve slightly different purposes. For example, in my program, if I want to create a representation of a "plane" class, I can create a blueprint that contains "length of wings", "name of plane", "plane owner", etc etc. These are all attributes of the "plane" class. Then, if I want to create an object, or one instance of that plane class, I could create a new Plane (using the Plane() constructor method) and set the length of wings to 400ft, name of the plane to "Boeing 747" and plane owner to "John Doe". That makes this a unique instance of the plane class. I can't just fly a "plane" but I could fly a "Boeing 747". You can just enter a "blueprint" but you can enter a building made from a "blueprint".
Subject: Android Programming
Hello! I am new to Android development and I do not entirely understand how layout works and how to make my JAVA logic interact with things that the user can touch on the touchscreen. Can you help me make something happen when I tap on the screen?
needs and Aakash will reply soon.