title
Java Tutorial For Beginners 18 - Classes and Objects in Java

description
In this Java Tutorial For Beginners video I am going to show how to use Classes and Objects in Java, OO Programming Concepts, Creating Objects and Object Reference Variables, Differences between primitive data type and object type, Automatic garbage collection, Constructors ★★★Top Online Courses From ProgrammingKnowledge ★★★ Python Programming Course ➡️ http://bit.ly/2vsuMaS ⚫️ http://bit.ly/2GOaeQB Java Programming Course ➡️ http://bit.ly/2GEfQMf ⚫️ http://bit.ly/2Vvjy4a Bash Shell Scripting Course ➡️ http://bit.ly/2DBVF0C ⚫️ http://bit.ly/2UM06vF Linux Command Line Tutorials ➡️ http://bit.ly/2IXuil0 ⚫️ http://bit.ly/2IXukt8 C Programming Course ➡️ http://bit.ly/2GQCiD1 ⚫️ http://bit.ly/2ZGN6ej C++ Programming Course ➡️ http://bit.ly/2V4oEVJ ⚫️ http://bit.ly/2XMvqMs PHP Programming Course ➡️ http://bit.ly/2XP71WH ⚫️ http://bit.ly/2vs3od6 Android Development Course ➡️ http://bit.ly/2UHih5H ⚫️ http://bit.ly/2IMhVci C# Programming Course ➡️ http://bit.ly/2Vr7HEl ⚫️ http://bit.ly/2W6RXTU JavaFx Programming Course ➡️ http://bit.ly/2XMvZWA ⚫️ http://bit.ly/2V2CoAi NodeJs Programming Course ➡️ http://bit.ly/2GPg7gA ⚫️ http://bit.ly/2GQYTQ2 Jenkins Course For Developers and DevOps ➡️ http://bit.ly/2Wd4l4W ⚫️ http://bit.ly/2J1B1ug Scala Programming Tutorial Course ➡️ http://bit.ly/2PysyA4 ⚫️ http://bit.ly/2PCaVj2 Bootstrap Responsive Web Design Tutorial ➡️ http://bit.ly/2DFQ2yC ⚫️ http://bit.ly/2VoJWwH MongoDB Tutorial Course ➡️ http://bit.ly/2LaCJfP ⚫️ http://bit.ly/2WaI7Ap QT C++ GUI Tutorial For Beginners ➡️ http://bit.ly/2vwqHSZ ★★★ Online Courses to learn ★★★ Get 2 FREE Months of Unlimited Classes from skillshare - https://skillshare.eqcm.net/r1KEj Data Science - http://bit.ly/2lD9h5L | http://bit.ly/2lI8wIl Machine Learning - http://bit.ly/2WGGQpb | http://bit.ly/2GghLXX Artificial Intelligence - http://bit.ly/2lYqaYx | http://bit.ly/2NmaPya MERN Stack E-Degree Program - http://bit.ly/2kx2NFe | http://bit.ly/2lWj4no DevOps E-degree - http://bit.ly/2k1PwUQ | http://bit.ly/2k8Ypfy Data Analytics with R - http://bit.ly/2lBKqz8 | http://bit.ly/2lAjos3 AWS Certification Training - http://bit.ly/2kmLtTu | http://bit.ly/2lAkQL1 Projects in Java - http://bit.ly/2kzn25d | http://bit.ly/2lBMffs Machine Learning With TensorFlow - http://bit.ly/2m1z3AF | http://bit.ly/2lBMhnA Angular 8 - Complete Essential Guide - http://bit.ly/2lYvYRP Kotlin Android Development Masterclass - http://bit.ly/2GcblsI Learn iOS Programming Building Advance Projects - http://bit.ly/2kyX7ue ★★★ Follow ★★★ My Website - http://www.codebind.com DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support! classes and objects in java pdf classes and objects in java ppt classes and objects in c++ classes in java classes and objects in java with realtime examples methods in java encapsulation in java define class in java

detail
{'title': 'Java Tutorial For Beginners 18 - Classes and Objects in Java', 'heatmap': [{'end': 266.9, 'start': 218.233, 'weight': 0.799}, {'end': 750.466, 'start': 624.935, 'weight': 0.74}], 'summary': 'Tutorial series covers java object-oriented basics, creation and usage of classes in eclipse, and encapsulation in java, emphasizing the importance of classes, their role in defining data structures, member variables, and methods, and the usage of getter and setter methods for class variables to ensure data security, access control, and integrity.', 'chapters': [{'end': 108.178, 'segs': [{'end': 108.178, 'src': 'embed', 'start': 32.74, 'weight': 0, 'content': [{'end': 45.324, 'text': 'you may have noticed that whenever we have created our first program, it was class, and inside this class we were calling this main method.', 'start': 32.74, 'duration': 12.584}, {'end': 50.988, 'text': 'so every Java project has at least one class and one main method,', 'start': 45.324, 'duration': 5.664}, {'end': 63.976, 'text': 'and class is basically a data structure or type inside which you can define some variables which are called member variables,', 'start': 50.988, 'duration': 12.988}, {'end': 67.819, 'text': 'and methods which are called member methods.', 'start': 63.976, 'duration': 3.843}, {'end': 77.883, 'text': 'and And the most important property of classes are you can create instance or object from class.', 'start': 67.819, 'duration': 10.064}, {'end': 85.165, 'text': 'So you can maintain different states of a class using these instances or objects.', 'start': 78.323, 'duration': 6.842}, {'end': 97.67, 'text': "So let's see how we can define a class which will be a new class and how we can use it with our main class which is my class.", 'start': 86.286, 'duration': 11.384}, {'end': 108.178, 'text': 'For example, we want to make some student data structure and for that we will make a class.', 'start': 99.091, 'duration': 9.087}], 'summary': 'In java, a project has at least one class and main method. classes contain member variables and methods, and can create instances for different states. a new class for student data structure can be created and used with the main class.', 'duration': 75.438, 'max_score': 32.74, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZHLdVRXIuC8/pics/ZHLdVRXIuC832740.jpg'}], 'start': 0.984, 'title': 'Java object oriented basics', 'summary': 'Introduces the object-oriented aspects of java, emphasizing the importance of classes, their role in defining data structures, member variables, and methods, and the ability to create instances or objects from classes.', 'chapters': [{'end': 108.178, 'start': 0.984, 'title': 'Java object oriented basics', 'summary': 'Introduces the object-oriented aspects of java, emphasizing the importance of classes and their role in defining data structures and member variables and methods. it also highlights the ability to create instances or objects from classes, enabling the maintenance of different states.', 'duration': 107.194, 'highlights': ['Classes in Java are essential, with every Java project having at least one class and one main method, serving as a data structure for defining member variables and methods.', 'The ability to create instances or objects from classes allows for maintaining different states, exemplified by the creation of a new class for student data structure.']}], 'duration': 107.194, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZHLdVRXIuC8/pics/ZHLdVRXIuC8984.jpg', 'highlights': ['Classes in Java are essential, serving as a data structure for defining member variables and methods.', 'The ability to create instances or objects from classes allows for maintaining different states.']}, {'end': 611.884, 'segs': [{'end': 266.9, 'src': 'heatmap', 'start': 108.998, 'weight': 0, 'content': [{'end': 115.963, 'text': 'So just go to your project if you are using Eclipse and go to the package you have made.', 'start': 108.998, 'duration': 6.965}, {'end': 120.387, 'text': 'We have made a lesson one package at the starting of this video series.', 'start': 116.104, 'duration': 4.283}, {'end': 128.752, 'text': 'Go to that package inside which you will be having a class, my class in my case.', 'start': 121.007, 'duration': 7.745}, {'end': 142.852, 'text': 'Just go to the package, right click the same package and go to new and create a new class and this class name we will name it as student.', 'start': 129.533, 'duration': 13.319}, {'end': 151.927, 'text': 'ok and leave everything as default and click finish.', 'start': 145.706, 'duration': 6.221}, {'end': 158.129, 'text': 'and now we have this student class inside our lesson one package.', 'start': 151.927, 'duration': 6.202}, {'end': 159.569, 'text': 'so we have two classes now.', 'start': 158.129, 'duration': 1.44}, {'end': 167.311, 'text': 'my class is the first class which we were working on and the second class is called student dot Java,', 'start': 159.569, 'duration': 7.742}, {'end': 170.732, 'text': 'and this is the second class we have created now.', 'start': 167.311, 'duration': 3.421}, {'end': 177.894, 'text': 'now this class can have its member variables and methods.', 'start': 171.472, 'duration': 6.422}, {'end': 182.155, 'text': 'so, for example, what can be the traits of the student?', 'start': 177.894, 'duration': 4.261}, {'end': 187.037, 'text': 'student can have his ID, so ID is integer value.', 'start': 182.155, 'duration': 4.882}, {'end': 190.457, 'text': 'so I declare a variable called ID.', 'start': 187.037, 'duration': 3.42}, {'end': 205.408, 'text': 'student can have name, so I declare a variable called name, and student can have age his age, so I declare student age.', 'start': 190.457, 'duration': 14.951}, {'end': 208.069, 'text': 'okay, so this is basically.', 'start': 205.408, 'duration': 2.661}, {'end': 212.23, 'text': 'you have created a class and it can have member variables.', 'start': 208.069, 'duration': 4.161}, {'end': 215.872, 'text': 'it can also have member methods.', 'start': 212.23, 'duration': 3.642}, {'end': 218.233, 'text': 'that we will see in a moment.', 'start': 215.872, 'duration': 2.361}, {'end': 226.336, 'text': "but let's consider, this is a basic student class which contains three variables ID, name and age.", 'start': 218.233, 'duration': 8.103}, {'end': 230.279, 'text': 'okay, now to call this class.', 'start': 226.776, 'duration': 3.503}, {'end': 241.167, 'text': 'in your main method, in my my class, you can just create an instance of or object of the class.', 'start': 230.279, 'duration': 10.888}, {'end': 242.808, 'text': 'so how you can do it?', 'start': 241.167, 'duration': 1.641}, {'end': 246.591, 'text': 'you can just call the same name, student class name.', 'start': 242.808, 'duration': 3.783}, {'end': 254.396, 'text': 'just copy this name here and then give the name to your instance.', 'start': 246.591, 'duration': 7.805}, {'end': 266.9, 'text': 'so as we have, we give any name to our variables, for example age name or something here also, you can give the name to the students variable.', 'start': 255.197, 'duration': 11.703}], 'summary': 'Creating a student class with member variables and methods in eclipse, resulting in two classes and instance creation in main method.', 'duration': 137.593, 'max_score': 108.998, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZHLdVRXIuC8/pics/ZHLdVRXIuC8108998.jpg'}, {'end': 611.884, 'src': 'embed', 'start': 533.043, 'weight': 3, 'content': [{'end': 542.195, 'text': 'okay, once again we will run the program And it says Mark is 15 years old and Tom is 14 years old.', 'start': 533.043, 'duration': 9.152}, {'end': 548.182, 'text': 'So using a class, we can define different object.', 'start': 543.617, 'duration': 4.565}, {'end': 556.312, 'text': 'And we can define these object values of object member variable values.', 'start': 548.803, 'duration': 7.509}, {'end': 559.935, 'text': 'which are independent of each other.', 'start': 557.553, 'duration': 2.382}, {'end': 569.766, 'text': "So this instance values which are id, Tom's id, Tom's name and Tom's age is independent of Mark's id, Mark's name and Mark's age.", 'start': 560.015, 'duration': 9.751}, {'end': 582.437, 'text': "okay. so this is very important property of object that it can store its own state and it's independent of the other instance.", 'start': 570.345, 'duration': 12.092}, {'end': 597.291, 'text': 'right now, in you know, in Java programming or programming in general, we never use or this kind of usage.', 'start': 582.437, 'duration': 14.854}, {'end': 601.675, 'text': 'direct usage of variables are discouraged.', 'start': 597.291, 'duration': 4.384}, {'end': 603.436, 'text': "and why it's discouraged?", 'start': 601.675, 'duration': 1.761}, {'end': 611.884, 'text': 'because any other person, or whoever is, whoever is using your code, can modify these values.', 'start': 603.436, 'duration': 8.448}], 'summary': 'Using a class to define independent object member variable values, discouraging direct variable usage in programming.', 'duration': 78.841, 'max_score': 533.043, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZHLdVRXIuC8/pics/ZHLdVRXIuC8533043.jpg'}], 'start': 108.998, 'title': 'Creating and using classes in eclipse and oop basics', 'summary': "Covers creating a new 'student' class in eclipse and the basics of object-oriented programming including the use of class instances to store independent member variable values such as id, name, and age, and emphasizes encapsulation in java programming.", 'chapters': [{'end': 177.894, 'start': 108.998, 'title': 'Creating a new class in eclipse', 'summary': "Explains how to create a new class named 'student' in eclipse within a specific package, emphasizing the process and the result of having two classes, 'my class' and 'student class', with the latter capable of having member variables and methods.", 'duration': 68.896, 'highlights': ["The chapter explains the process of creating a new class named 'student' in Eclipse within a specific package.", "Emphasizes the result of having two classes, 'my class' and 'student class', after creating the new class.", "Highlights that the 'student class' is capable of having member variables and methods."]}, {'end': 611.884, 'start': 177.894, 'title': 'Object oriented programming basics', 'summary': 'Explains the basics of object-oriented programming with a focus on creating and using class instances to store independent member variable values like id, name, and age, and emphasizes the importance of encapsulation in java programming.', 'duration': 433.99, 'highlights': ["Instances of a class can store independent member variable values like ID, name, and age Instances such as 'mark' and 'tom' store independent values for their ID, name, and age, demonstrating the encapsulation and independence of object state.", 'Emphasizes the importance of encapsulation in Java programming Direct usage of variables is discouraged in Java programming to maintain the independence and integrity of object state, ensuring that values are not modified by external entities.', "Demonstrates the process of creating and using class instances in Java programming The process involves creating instances of a class, such as 'mark' and 'tom', and assigning values to their member variables, showcasing the basic principles of object-oriented programming."]}], 'duration': 502.886, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZHLdVRXIuC8/pics/ZHLdVRXIuC8108998.jpg', 'highlights': ["The chapter explains the process of creating a new class named 'student' in Eclipse within a specific package.", "Emphasizes the result of having two classes, 'my class' and 'student class', after creating the new class.", "Highlights that the 'student class' is capable of having member variables and methods.", 'Instances of a class can store independent member variable values like ID, name, and age.', 'Emphasizes the importance of encapsulation in Java programming.', 'Demonstrates the process of creating and using class instances in Java programming.']}, {'end': 930.729, 'segs': [{'end': 750.466, 'src': 'heatmap', 'start': 624.935, 'weight': 0.74, 'content': [{'end': 641.932, 'text': 'okay. so what I mean by getting and setting these values is I can go to this class called student and in here I can just use.', 'start': 624.935, 'duration': 16.997}, {'end': 648.079, 'text': 'I can just go to the source tab and in here I can go to.', 'start': 641.932, 'duration': 6.147}, {'end': 658.316, 'text': 'so we will go to the source and just go to generate getters and setters here.', 'start': 651.391, 'duration': 6.925}, {'end': 663.619, 'text': 'and here we can see, operation is not applicable in current class.', 'start': 658.316, 'duration': 5.303}, {'end': 672.726, 'text': 'okay, and in here we will just use this and click once again getters and setters.', 'start': 663.619, 'duration': 9.107}, {'end': 678.129, 'text': 'so just click one variable name or variable.', 'start': 673.546, 'duration': 4.583}, {'end': 680.13, 'text': 'then only this will work.', 'start': 678.129, 'duration': 2.001}, {'end': 686.533, 'text': 'so go to source once again and create getters and setters and in here select all.', 'start': 680.13, 'duration': 6.403}, {'end': 700.526, 'text': "so we are basically making getter and setter method for every value, because we don't want to use or we don't want to access these variable directly.", 'start': 686.533, 'duration': 13.993}, {'end': 707.433, 'text': 'we just create getters and setters for all of them and whenever we click ok, you can see,', 'start': 700.526, 'duration': 6.907}, {'end': 713.119, 'text': 'here java has created us these getters and setters for all these values.', 'start': 707.433, 'duration': 5.686}, {'end': 726.033, 'text': 'okay, and what this is basically doing is it has we, whenever we want to, you know, assign some value to the ID?', 'start': 713.945, 'duration': 12.088}, {'end': 738.502, 'text': 'we will use set ID method and whenever we want to get the value of ID, we will use get method and this is called encapsulation of a variable.', 'start': 726.033, 'duration': 12.469}, {'end': 750.466, 'text': "this is important because we don't want to give access to our variables to some other user which is unknown to us right,", 'start': 739.382, 'duration': 11.084}], 'summary': 'Demonstration of creating getter and setter methods for encapsulation in a java class.', 'duration': 125.531, 'max_score': 624.935, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZHLdVRXIuC8/pics/ZHLdVRXIuC8624935.jpg'}, {'end': 750.466, 'src': 'embed', 'start': 686.533, 'weight': 0, 'content': [{'end': 700.526, 'text': "so we are basically making getter and setter method for every value, because we don't want to use or we don't want to access these variable directly.", 'start': 686.533, 'duration': 13.993}, {'end': 707.433, 'text': 'we just create getters and setters for all of them and whenever we click ok, you can see,', 'start': 700.526, 'duration': 6.907}, {'end': 713.119, 'text': 'here java has created us these getters and setters for all these values.', 'start': 707.433, 'duration': 5.686}, {'end': 726.033, 'text': 'okay, and what this is basically doing is it has we, whenever we want to, you know, assign some value to the ID?', 'start': 713.945, 'duration': 12.088}, {'end': 738.502, 'text': 'we will use set ID method and whenever we want to get the value of ID, we will use get method and this is called encapsulation of a variable.', 'start': 726.033, 'duration': 12.469}, {'end': 750.466, 'text': "this is important because we don't want to give access to our variables to some other user which is unknown to us right,", 'start': 739.382, 'duration': 11.084}], 'summary': 'Encapsulation is used to create getters and setters for variables in java, ensuring controlled access to the data.', 'duration': 63.933, 'max_score': 686.533, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZHLdVRXIuC8/pics/ZHLdVRXIuC8686533.jpg'}, {'end': 895.743, 'src': 'embed', 'start': 847.741, 'weight': 4, 'content': [{'end': 857.679, 'text': 'we will assign this name to tom and tom dot set age same thing here.', 'start': 847.741, 'duration': 9.938}, {'end': 871.284, 'text': 'So basically what we have done we have used instead of a direct assignment, we are assigning values using these getters and setters.', 'start': 861.4, 'duration': 9.884}, {'end': 874.905, 'text': 'And this protects your data from corrupting.', 'start': 872.004, 'duration': 2.901}, {'end': 879.027, 'text': 'if somebody wants to corrupt your data or something like this, okay?', 'start': 874.905, 'duration': 4.122}, {'end': 895.743, 'text': 'And to get these value, you just call mark.getName and mark.getAge.', 'start': 880.387, 'duration': 15.356}], 'summary': 'Using getters and setters protects data from corruption.', 'duration': 48.002, 'max_score': 847.741, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZHLdVRXIuC8/pics/ZHLdVRXIuC8847741.jpg'}], 'start': 612.725, 'title': 'Encapsulation and getters/setters in java', 'summary': 'Covers encapsulation in java, emphasizing the creation and usage of getter and setter methods for class variables to ensure data security, access control, and integrity. it also highlights the importance of using getters and setters to protect data from corruption.', 'chapters': [{'end': 750.466, 'start': 612.725, 'title': 'Encapsulation in java', 'summary': 'Explains the concept of encapsulation in java, demonstrating the creation of getter and setter methods for class variables, ensuring data security and access control, with an emphasis on not accessing variables directly and using getters and setters for all values.', 'duration': 137.741, 'highlights': ['Java creates getter and setter methods for all class variables, demonstrating encapsulation of data for access control.', 'Emphasizes the importance of not accessing variables directly, and using getter and setter methods for assigning and retrieving values, ensuring data security and access control.', 'The process involves creating getter and setter methods for every value in the class, preventing direct access to variables and ensuring data security and access control.']}, {'end': 930.729, 'start': 750.466, 'title': 'Using getters and setters in java', 'summary': 'Explains the importance of using getters and setters in java classes to protect data from corruption, and demonstrates their usage in assigning values to member variables, ensuring data integrity and security.', 'duration': 180.263, 'highlights': ['The chapter emphasizes the use of getters and setters in Java classes to protect data from corruption, ensuring data integrity and security.', 'It demonstrates the usage of getters and setters in assigning values to member variables, promoting data security and integrity.', 'The chapter highlights the importance of using getters and setters in Java classes to prevent data corruption and ensure data security.']}], 'duration': 318.004, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZHLdVRXIuC8/pics/ZHLdVRXIuC8612725.jpg', 'highlights': ['Java creates getter and setter methods for all class variables, demonstrating encapsulation of data for access control.', 'Emphasizes the importance of not accessing variables directly, and using getter and setter methods for assigning and retrieving values, ensuring data security and access control.', 'The process involves creating getter and setter methods for every value in the class, preventing direct access to variables and ensuring data security and access control.', 'The chapter emphasizes the use of getters and setters in Java classes to protect data from corruption, ensuring data integrity and security.', 'It demonstrates the usage of getters and setters in assigning values to member variables, promoting data security and integrity.', 'The chapter highlights the importance of using getters and setters in Java classes to prevent data corruption and ensure data security.']}], 'highlights': ['Emphasizes the importance of using getters and setters in Java classes to prevent data corruption and ensure data security.', 'The process involves creating getter and setter methods for every value in the class, preventing direct access to variables and ensuring data security and access control.', 'Java creates getter and setter methods for all class variables, demonstrating encapsulation of data for access control.', 'The chapter emphasizes the use of getters and setters in Java classes to protect data from corruption, ensuring data integrity and security.', 'The chapter highlights the importance of encapsulation in Java programming.', 'Demonstrates the process of creating and using class instances in Java programming.', 'Instances of a class can store independent member variable values like ID, name, and age.', 'The ability to create instances or objects from classes allows for maintaining different states.', "The chapter explains the process of creating a new class named 'student' in Eclipse within a specific package.", "Emphasizes the result of having two classes, 'my class' and 'student class', after creating the new class.", 'Classes in Java are essential, serving as a data structure for defining member variables and methods.']}