Are you ready to elevate your career in IT?
Dive into our Full Stack Java Development course designed for all skill levels. Whether you're a seasoned IT professional looking to expand your skillset or a newcomer eager to explore the world of web development, our comprehensive course is crafted to cater to all levels of expertise.
Are you ready to elevate your career in IT?
Dive into our Full Stack Java Development course designed for all skill levels. Whether you're a seasoned IT professional looking to expand your skillset or a newcomer eager to explore the world of web development, our comprehensive course is crafted to cater to all levels of expertise.
The course begins with a solid foundation in Java, ensuring a seamless transition for beginners and a perfect refresher for those with existing Java knowledge. Dive deep into Java fundamentals, exploring key concepts such as Lambdas Expression, Java Generics, Collections, Multithreading, and File handling. Our expertly designed curriculum doesn't just stop at the basics; we guide you through the details of debugging in IntelliJ IDEA, ensuring you develop the crucial skill of identifying and fixing errors efficiently.
As you progress, immerse yourself in the dynamic universe of web development with a focus on JSP and Servlets, essential components in building robust Java web applications. Harness the power of Hibernate and Spring framework, both built on the latest Java 17 LTS version, to master the art of seamless data persistence and efficient application development.
Our course places a special emphasis on mastering Spring Boot REST, a vital component in contemporary web development. Explore RESTful APIs and gain a profound understanding of JavaScript basics, which is essential for creating dynamic and interactive web pages. Dive into JSTL and Restful Micro-webservices concepts, covering the legacy part of the course built on Java 8, ensuring you are well-versed in both the latest advancements and established practices.
Take your skills to the next level with in-depth coverage of advanced topics such as HATEOS introduction, Junit, and testing methods, as well as Testing exceptions. Our commitment to providing a holistic learning experience means you'll not only grasp the theoretical aspects but also gain practical insights through real-world projects.
Join our course, and benefit from a curriculum that is carefully curated to align with the demands of the ever-evolving IT landscape. Whether you're aiming for a career transition or seeking to enhance your existing skills, our Full Stack Java Developer course is your gateway to success in the dynamic and high-demand field of web development.
Course Highlights
High-quality video content
Course materials (Project files and quizzes)
Get a FREE 6-month subscription for IntelliJ IDEA Ultimate or another JetBrains IDE of your choice
More than 650+ Lectures and 70+ hours of video content
Latest tools and software versions used
Course built on the latest JAVA 17 LTS version
Legacy concepts (Additional content on Java 8)
What Sets Us Apart?
Extensive Content: With over 650+ lectures and 70+ hours of high-quality video content, our course leaves no stone unturned in equipping you with the knowledge and skills needed to excel as a Full Stack Java Developer.
Latest Tools and Technologies: Stay ahead of the curve with our course built on the latest Java 17 LTS version, coupled with legacy concepts on Java 8. Experience hands-on learning with industry-standard tools like IntelliJ IDEA, Eclipse IDE, and VS Code IDE.
Focus on Modern Technologies: Immerse yourself in the world of modern web development with a special emphasis on React, Spring Boot, Restful Microservices, and JavaScript basics. From setting up React JS to implementing Swagger using React, our course covers it all.
Uncover the top skills taught in our course
Java Programming
Spring Framework
Back-End Development
Front-End Development
Server-Side Architecture
New Addition: Dive into the Exciting World of React
But that's not all.
In response to the growing demand for cutting-edge technologies, we've added a comprehensive section on React. Explore topics such as setting up React JS, user management, making
What you’ll learn
Enhance your foundational understanding of Java to seamlessly transition into advanced frameworks such as Spring, Java EE, and JavaScript.
Develop expertise in the latest Java version, Java 17, while also mastering earlier iterations including Java 8.
Elevate your programming skills with comprehensive Java fundamentals for a holistic grasp of key concepts essential for advanced development.
Build a fully functioning web application through a simplistic step from a professional trainer.
Java programming language
Learn Java server pages(JSP), Servlets, and JSTL from the basics to advance
Understand building web forms with JSP
Apply validations on the forms
Use the web template to make the web application incredible
Learn how to Handle Sessions in JSP
Develop Dynamic Web Applications
Learn MVC in JSP
Forms under JSP and Servlets
Learn the concept related to Generics
Add validations on form data
Adding records to the database
Updating record(s) into a database
Deleting record(s) into a database
Spring Framework
Web Services – RestFul API
Spring Boot
Spring Boot Restful API
JavaScript basics
Build frontend using REACT
JUnit
Course Curriculum Content
Build a Strong Foundation in JavaThe course begins with a solid foundation in Core Java, ensuring a seamless transition for beginners and a perfect refresher for those with existing Java knowledge. Dive deep into Java fundamentals, exploring key concepts such as Lambdas Expression, Java Generics, Collections, Multithreading, and File handling. Our expertly designed curriculum doesn't just stop at the basics; we guide you through the details of debugging in IntelliJ IDEA, ensuring you develop the crucial skill of identifying and fixing errors efficiently.
Topics have been covered:
Decision-making under Java
Object-oriented programming concepts
Collections framework & debugging
Generics
Multi-threading
Lambdas
File Handling under Java
Explore the World of Web Development
Dive deep into the realm of web development with JSP and Servlets, mastering the art of building resilient Java web applications. Seamlessly integrate Hibernate and Spring frameworks, leveraging the power of Java 17 LTS to achieve unparalleled efficiency in data persistence and application development.
Topics in this section:
Apply validations on the forms
Create & Deploy Java Servlets
Learn how to Handle Sessions in JSP
Develop Dynamic Web Applications
Forms under JSP and Servlets
Adding records to the database
Updating record(s) into a database
Deleting record(s) into a database
Image/File upload
Hibernate for Database Operations
Establish a robust connection between Hibernate and databases.
Dive into Hibernate Query Language (HQL) basics.
Perform CRUD operations seamlessly with Hibernate.
Special Emphasis on Spring Boot REST
Make your applications come alive with Spring Boot, the shining light of modern Java development. Dive into the Spring ecosystem, covering IoC, Dependency Injection, Restful APIs, JWT token generation, and more, with a special focus on Spring Boot for rapid application development. Learn how to use Spring Boot effectively to create strong, flexible web applications that can handle challenges and grow over time.
Topics in this section:
Spring Framework
Inversion of control
Spring Beans
Resource-based URIs for CRUD methods
JSON response
HATEOAS - get links from resources
Idempotence of HTTP Methods
Method parameter and return type
Spring Boot REST API
Spring Boot JWT token generator
Integration of H2 database in Spring Boot
Web template Integration
Update Profile (Account) on the Spring Boot Blog
Adding Spring security into the application
Spring security login, adding rules and Bcrypt password
Web App with spring boot
Sending email for password reset
Email Service in Spring Boot
Docker and WSL on Windows
Spring Boot OAuth2 JWT token generator
Spring Boot OAuth2 JWT Adding Public-private KeyGenerator
Spring boot The crown jewel of our curriculum lies in React
We've supercharged our curriculum with an exclusive focus on React, the powerhouse of frontend development. Elevate your skills with in-depth coverage of REACT, the cutting-edge JavaScript library for building user interfaces.
Begin your journey with JavaScript basics to setting up React JS and mastering Material UI, manage user interactions, make HTTP calls, and implement dynamic functionalities with ease, all within the sleek environment of VS Code IDE. From token handling to Swagger implementation, our REACT section is designed to empower you with the latest tools and techniques for crafting cutting-edge front-end experiences.
Topics in this section:
JavaScript basics
Keywords, datatypes in JavaScript
Normal functions and expression functions in JavaScript
Foreach methods
JavaScript - Dom Object
JavaScript - Callback functions
React
Setting up React JS
Material ui with React
User management with react
Making
Topics in this section:
Fundamentals of the JUnit testing framework
JUnit Testing
Gain proficiency in the JUnit testing framework and explore testing exceptions.
Structure and implementation of effective test methods
Techniques for testing exceptions
And many more.
Micro-Web Services and JSTL
Concluding the curriculum, Discover the legacy concepts of Spring Legacy, Restful Micro-Web Services, JSP & Servlets, and JavaServer Pages Standard Tag Library (JSTL) covering both basic and advanced concepts all developed on Java 8, ensuring you're well-versed in both cutting-edge technologies and established practices.
Key Learning Objectives
Java Fundamentals: Master core Java concepts, including multi-threading, Lambdas, Collections framework, and file handling.
Hibernate: Explore Hibernate, learn to build applications using JSP and Hibernate, and perform CRUD operations.
Spring Framework: Dive into the Spring framework, covering Inversion of Control, Dependency Injection, and more.
Spring Boot: Gain in-depth knowledge of Spring Boot, covering migrations, security integration, Thymeleaf tags, and Restful API implementation.
JavaScript Basics: Understand essential JavaScript concepts, including objects, loops, decision-making, array methods, and asynchronous JavaScript.
React: Setting up React JS, Material ui with React, User management with react, Making HTTP GET call with axios, Local server, CORS and Proxy in React, Login functionality, Albums use case in React, token handling and local storage with react, Dynamic menus and updated registration page, Swagger implementation using React, Upload photos onto the Albums, Props, useEffect and Async, Albums Show page, Add, Edit, Delete functionality, Show Photos using Albums API.
Course Features
Understand the end-to-end process of building web forms with JSP and Servlets.
Acquire a strong foundation in object-oriented programming, covering core concepts, method parameters, return types, arrays, collections, and debugging.
Implement sessions in JSP for efficient web application management.
Apply a wide range of concepts to projects, allowing you to practice and reinforce your new skills.
Why Choose This Course?
Comprehensive Content: Covering essential concepts, tools, functions, and topics required for Java Developers in the web application development process.
Unique Teaching Style: Experience a unique and easy-to-understand teaching approach that caters to various learning styles.
Comprehensive Learning: From theory to practice, from legacy to cutting-edge, our curriculum leaves no stone unturned, ensuring you emerge as a well-rounded, versatile developer.
Hands-On Approach: Learn by doing with a hands-on approach that lets you practice and reinforce your learning.
Career Booster: In today's competitive landscape, mastering Full Stack Java Development isn't just an advantage — it's a necessity. With our course, you'll unlock doors to exciting career opportunities and pave your path to success.
Why Learn Full Stack Java Development?
In today's digital era, where web applications drive businesses, full-stack Java Developers are in high demand. Mastering Full Stack Java Development empowers you to create dynamic and static web content, offering a skill set that is crucial in the ever-evolving IT landscape.
About the Instructor
Our experienced instructor, with over 8 years of teaching IT to 200,000+ students, is also a seasoned web application developer. His unique teaching style ensures that you not only grasp the concepts but also enjoy the learning process.
Enroll Risk-Free
Still hesitating? Rest easy with our No Question Asked - Money Back Guarantee.
If you're not satisfied within the first 30 days, we'll refund your investment — no strings attached. Your journey to mastery begins with a single step — Enroll Today, Transform Tomorrow.
With our easy-to-follow curriculum, you'll be amazed at how quickly you can master Java, Spring Boot REST, and JavaScript. Remember, practice makes perfect, and your efforts will shape your success.
Don't miss the opportunity to propel your career forward and unlock your full potential in the world of IT.
Enroll today and become the architect of tomorrow's web. Your destiny awaits — seize it now.
See you on the course.
History of Java
In 1990, Sun Microsystems launched a project called Green to develop software for consumer electronic products. Gosling began to write software in C ++ to embed elements such as toast, VCR, and personal digital assistants (PDA). The history of java started with Green Team. In this team, there were three members James Gosling, Mike Sheridan, and Patrick Naughton protecting the language started in June of 1991.
It was named “Greentalk” by James Gosling. The file extension was ".gt". Later it was called Oak. Oak is a national tree of many countries like the U.S.A, France, Germany, Romania, etc. In May 1995, Oak was renamed as “Java” given by James Gosling, by then it was already a trademark of the organization.
There were more choices of names before finalizing, but Java was so unique, so James and most of his team members preferred Java.
A more interesting fact is related to Java, Java is an island in Indonesia where the first coffee was produced and the name of the coffee was Java. Java is a name, not an acronym.Java coffee consumed in large quantities by the creator of the language. This indicates the story behind the logo of Java.
#History #Java #Programming #Language #JamesGosling #Inventor
Java Versions and How to Set Up Your Computer: A Simple Guide
Java is a flexible programming language with many versions designed for different uses. With so many options, it's important to pick the right version for your needs. We'll take a look at Java versions, especially the important Long-Term Support (LTS) ones.
Java 8 was the first LTS version. It's a bit old now, but still widely used, even though it's a little different from newer versions. If you write code in Java 8, you might find it doesn't work the same in later versions. So, the version you choose is very important for making sure your code will work and for making coding easier.
Fast forward to the present, Java 17 is the latest LTS version, known for its better features and reliability. Java 21 is coming soon, but Java 17 is currently the best choice for reliable and supported Java use. Now, let's talk about what you need to actually use Java. You'll want a good Integrated Development Environment (IDE), and IntelliJ IDEA is a great one that's easy to use for Java coding. It comes in both paid and free versions, and the free one is good enough for most people.
Downloading and installing IntelliJ IDEA is simple. Just click to download IntelliJ IDE, and you'll be set up in no time. It has a clear interface that makes starting a new project easy. For Java coding, you need the Java Development Kit (JDK), and IntelliJ IDEA makes it easy to manage this with a built-in feature. Just a few clicks and you'll have the newest JDK ready to go in your IDE, which means less trouble as you develop your programs.
With IntelliJ IDEA and the latest JDK, you're all set to start using Java.
#Java #Programming #IntelliJIDEA #JavaCoding #CodingGuide #LTSVersions #SetUpGuide
Guide to Importing Projects into IntelliJ IDEA
The ability to import projects quickly and accurately into their preferred Integrated Development Environment (IDE) is not just a convenience; it's a necessity that saves time and streamlines workflow. IntelliJ IDEA, a leading IDE for Java development, offers robust features for project import that cater to both novices and seasoned professionals. This guide will walk you through the essential steps and tips to ensure your project import into IntelliJ IDEA is as smooth as silk.
Core Steps for Importing Projects
Start IntelliJ IDEA
Launch IntelliJ IDEA. If you have a project open, close it by going to File > Close Project.
Import Project:
On the Welcome screen, click Import Project.
Navigate to your project directory and select the project you wish to import.
Select Import Project Type:
Choose the appropriate type of project to import based on your project's existing structure, such as Maven, Gradle, or a simple directory structure.
Configure Project Settings:
Follow these steps to configure the project settings. Set the JDK for the project and resolve any dependency issues.
Finish Import:
Review your settings and click Finish to complete the import process. The IDE will now open your project.
Alternative Method: Importing from Within the IDE
If you're already working within IntelliJ IDEA and need to import another project:
Access the Project Structure:
Go to File > Project Structure.
Add Module:
Click on the Modules section, then click the + button and select Import Module.
Select and Configure:
Choose the project you wish to import and configure it just like in the core steps outlined above.
Troubleshooting Common Issues
Missing JDK or OpenJDK Error:
Go to File > Project Structure > SDKs and add a JDK by providing the path to the JDK installation directory.
Ensure that the JDK version matches the one required for your project.
Dependency Resolution:
If the IDE cannot resolve dependencies, check your build configuration files (like pom.xml for Maven) for errors.
Use the Refresh option in the IDE's build tool window to synchronize the project.
By following the steps provided, you can seamlessly import your projects into IntelliJ IDEA.
#IntelliJIDEA #ProjectImport #CodingMadeEasy #TechTips #JavaDevelopment
Starting Your First Java Project with IntelliJ IDEA: A Beginner's Guide
If you're new to programming or looking to refresh your skills, starting with a simple project in IntelliJ IDEA is an excellent choice. Here we will guide you through setting up a basic "Hello World" application using IntelliJ IDEA, a popular integrated development environment (IDE) for Java developers.
Setting Up Your Environment
First things first, you'll need to set up your Java development environment. IntelliJ IDEA is a powerful Integrated Development Environment (IDE) that makes Java programming simpler and more efficient. Once you've launched IntelliJ IDEA, start by creating a new project.
For beginners, it's best to begin with an empty project to keep things uncomplicated.
Simply name your project "Hello World" to keep with tradition.
Choosing the Right Java Development Kit (JDK)
For your project, you will need a Java Development Kit. We'll use Microsoft Open JDK 17, just select the appropriate JDK from the list in IntelliJ IDEA. Don’t worry about using Maven for this project; we'll keep it straightforward by not using it.
Writing Your First Java Program
Once your project setup is complete, it's time to dive into coding. Add a simple "Hello World" program to your project. This classic first program is perfect as it's simple yet teaches the basic structure of Java code. If you’re using a sample code provided or writing your own, IntelliJ IDEA makes this process smooth with helpful tools and suggestions.
Building and Running Your Application
After writing your code, the next step is to see it in action! Run your application directly within IntelliJ IDEA to see the output. If everything is set up correctly, you’ll see "Hello World" or whatever output your code is designed to produce.
Handling Output and Artifacts
In development, outputs and artifacts are essential for understanding how your application is built and executed. Explore how IntelliJ IDEA handles these, and learn how to manage and utilize the .class files and the src folder where your Java files reside. These elements are crucial as they contain the bytecode and source code respectively.
Creating a JAR File
A crucial skill in Java development is learning how to package your application. In IntelliJ IDEA, navigate through the project structure to create a JAR file — a portable format for distributing your Java applications. Use the modules with dependencies to ensure your application runs smoothly on other systems.
Troubleshooting Common Issues
You might encounter issues like the "class not found" error when running your JAR file. This is often due to configuration problems which can be easily fixed by adjusting the settings in IntelliJ IDEA.
Make sure your project is correctly configured before exporting it to ensure smooth operation.
Keeping Your JDK Updated
Java is continuously evolving, and so are its development tools. The video tutorial was updated to reflect changes in OpenJDK and other versions, demonstrating the importance of keeping your development environment up to date. This ensures compatibility and enhances security.
Starting with a simple Java project in IntelliJ IDEA introduces you to the world of software development in an accessible and manageable way. Whether you're a student just beginning your coding journey or an IT professional polishing your skills, mastering these fundamentals is your first step towards more complex programming challenges.
Happy coding, and remember — the best way to learn is by doing!
Don't hesitate to experiment with your code and explore the extensive features available in IntelliJ IDEA.
#JavaBasics #Java #IntelliJIDEA #Programming #HelloWorld #EasyDeployment #CodingForBeginners
Creating a Simple Java Project in IntelliJ IDEA: A Step-by-Step Guide
In this tutorial, we'll walk through the steps to create your first project and even generate a JAR file, perfect for beginners, all with simplicity in mind.
Creating Your First Project
Getting Started: Launch IntelliJ IDEA and select "New Project" from the welcome screen.
Project Setup: Choose a new empty project, name it "Hello World," and select Java as the language.
Choosing JDK: If you have Java installed, pick the appropriate JDK.
Adding Sample Code: IntelliJ IDEA provides a basic structure for your project, including sample code to get you started.
Generating a JAR File
Want to take it a step further and create a JAR file? Fear not, it's simpler than you think!
Project Structure: Navigate to "File" > "Project Structure" to configure your project.
Creating JAR: Under "Artifacts," add a new JAR file and select "Build JAR from modules with dependencies."
Setting Main Class: Choose the class with the main method.
Build and Run: Apply the changes and click "OK" to generate the JAR file.
Running Your Application: Right-click on the generated JAR file and select "Run" to execute your program.
Tips and Tricks
Refreshing Project: If the output folder doesn't appear immediately, try refreshing or reloading the project.
Handling Configuration Issues: If you encounter a "class not found" exception, edit the configuration to ensure proper setup.
Staying Updated: Keep up with changes in JDK versions and IntelliJ IDEA UI to adapt to industry standards.
And there you have it! A basic Java project is up and running in no time. But remember, the tech world is ever-evolving. Stay curious, embrace change, and keep exploring. Until next time, happy coding!
#JavaProgramming #IntelliJIDEA #BeginnerFriendly #JDK17 #Maven
Keyword
This tutorial deals with the concept of keywords in Java. Keywords are special entities that are predefined in Java. These words cannot be used as identifiers. Out of the 50 keywords, 48 are currently in use (const and goto not in use).
A Java keyword is one of the 50 reserved keywords for a programming language. Each keyword has a specific meaning in the language. These keywords are already known by Java.
Rules to follow for keywords:
Keywords cannot be used as identifiers for class, subclass, variable, and methods.
Keywords are case-sensitive.
Here is a list of keywords in the Java programming language:
abstract
assert
boolean
break
byte
case
catch
char
class
const*
continue
default
do
double
else
enum
extends
final
finally
float
for
goto*
if
implements
import
instanceof
int
interface
long
native
new
package
private
protected
public
return
short
static
strictfp
super
switch
synchronized
this
throw
throws
transient
try
void
volatile
while
*****************************************************************
Some significant points about Java keywords:
true, false, and null might seem like keywords but aren't
All keywords are in lowercase.
More on this topic ahead of the tutorial.
#keywords #reserved words #case-sensitive #java #rules
Understanding Variables
The manipulation of two variables having the same datatype is shown. The variables can be modified with help of any constant or otherwise with the help of the same datatype. Issues such as case sensitivity and order of execution of statements are shown here.
The variable can be declared to store data in the program. There are few variations in how we can declare a variable in a programming language. The following program will demonstrate how we can declare and then initialize an int variable.
Multiple variable initializations within a statement
When it comes to multiple variable initializations, Java also supports multiple initializations within a single statement within the statement. We can also merge the declaration and initialization of multiple variables within a single. To initialize multiple variables, we need to use a comma-separated list.
Initialization of variable through arithmetic operation
After the arithmetic operation, the final result would be assigned to the variable. Assignment of the result is done using the assignment operator (=) and the assignment sequence is from right to left. If you make use of the bracket within the operation, operation inside the bracket would be performed first.
Assigning one primitive variable to another
We can also assign a value to a variable by using another variable. This is also called copying the value of one variable into another.
Demonstration
Assign any integer value to an int variable.
Assign the variable value to a variable.
Naming Convention
The names of variables are case sensitive “value” and “Value” both are different.
Space is not permitted in variable names
Primitive Data Types
This tutorial describes the integer datatype and the similar types of the datatype with a couple of differences. Various operations like the maximum and minimum are shown. The following primitive datatypes are discussed are as follows.
1.byte(memory->(1 byte,8 bit),range->(-128,127))
2.int (memory->(4 bytes,32 bits),range->(-2^31,2^31))
3.short(memory->(2 bytes,16 bits),range->(-2^15,2^15))
4.long(memory->(8 bytes,64 bits),range->(-2^63,2^63))
Java supports eight primitive data types. These are the basic and predefined datatype of programming language. The size of the primitive data type is fixed. Primitive data types are represented by reserved keywords.
The primitive data type is divided into following categorize
Integer data type.
Floating Point data type.
Boolean data type.
Char data type.
Integer data type
An integer data type is used to store integer numbers (numbers without a decimal point). The minimum and maximum value that a variable can store also depends on the data type.
The range of Integer data types
We have a list of integer datatype, As the memory allocation of these different flavors of integer datatype is different, the range of these data type also differs. Based on our requirement, we can choose any flavor of integer datatype, int datatype being the most popular and recommended, as int performs fastest among all the flavors.
byte
The size of the byte type is 8bit/1byte. The minimum value of the byte variable is -128 and the maximum being 127.
short
The short data type is an integer-compatible data type and used to contain an integer value. The size of the short type is 16bit/2byte.
int
The size of the int value is 32bit/4byte. The minimum value of int is -2,147,483,648 and the maximum range is 2,147,483,647.
long
The size of the long data type is 64bit/8byte. While declaring long data type we have to use the suffix “L” by default java considered it as an int. It is recommended that you use the uppercase letter “L” because these are case-sensitive.
Initialization of long variable:
long longMax = 9,223,372,036,854,775,807L;
long longMin = -9,223,372,036,854,775,808L;
[ L specifies that value is a long. ]
Floating Point data type
The tutorial describes the float and the double primitive datatypes. Mostly used while dealing with decimals. The float datatype occupies 4 bytes hence will have a range from -2^31 to 2^31. It has single-precision(7 decimals)hence it is not used for complex calculation. For that purpose, double is used. The double occupies 8 bytes and hence double precision(15 decimals). This also outlines the various techniques of implementing the above datatypes.
Floating-point variables are used to deal with the decimal value. There are two types of floating-point data types. float-point types with storage sizes and range with their precision.
In the program, whenever we want to store a floating-point value in a variable, we can use one of these data types accordingly.
Initialization of float variable:
float var = 9f;
[ f specifies that value is a float. ]
Precision in float (7 spaces)
*********************************
double: double is used to store value with precision up to 16 spaces, it occupies 64-bit memory
Initialization of double variable:
double var = 9d;
[ d specifies that value is double. ]
Precision in double data type is more than a float data type.
This deals with the boolean datatype. The boolean data type has only two possible values: true and false. This data type is used for simple flags that track true/false conditions. This data type represents one bit of information, but its memory constant isn't precisely defined. Char datatype is a 16-bit Unicode character. It has a lower limit of '\u0000' (0) and a highest value of '\uffff' (or 65,535) both inclusive.
Boolean
Boolean is a data type that represents one bit of information either true or false.
Char
A char data type is a single-length entity. This could be an alphabet, a digit, or a symbol. It is also used to hold the Unicode for symbols. Value for char should be with single quotes.
Note: We must only use the single quotes pointing to left
The length should be one.
Single quote point to the left should be used
Any character on the keyboard is allowed
Example: ‘A’,’*’,’1’
More details about these concepts can be understood in this lecture.
This session deals with the Strings. Strings represent character strings. The various rules associated with string are stated in addition to some operations. Also, an introduction to typecasting is given (which is a conversion between the datatypes).
String
A Sequence of characters inside double quotes is called String, for e.g., “Java” String is the sequence of 4 characters.
Initialization of String variable
In the below example, we will create a String. Here var is the reference of data “Hello World” of type String.
String var = "Hello World";
Unicode symbols can also be stored as String. Unicode is a universal international standard character encoding that represents most of the languages in the world.
String var1 = "\u00BB";
Discussions on the same are continued in upcoming lectures.
This lecture deals with typecasting from basics to advanced. The conversion from one datatype to another is described here. This tutorial covers both types of typecasting namely explicit and implicit typecasting. Implicit typecasting is automatically done by the compiler to convert datatypes with large memory space to short memory space. The other (Explicit typecasting)has to be manually declared. It covers all the rules for conversion for typecasting.
In Java, Type Casting is a process of converting a variable of one data type into another.
Typecasting is of two types:
Implicit typecasting.
Explicit typecasting.
Implicit typecasting
Implicit type casting is also known as Widening or Automatic typecasting. When a small range data type variable is converted into a large range data type, The process is called implicit typecasting.
Explicit typecasting
Explicit typecasting is also known as narrowing typecasting. When a large range data type is converted into small range data.
Do you know?
Data type should be compatible for conversion. A non-primitive data type cannot be converted into a primitive type.
The precision loss may happen in Explicit typecasting.
In this program, we will be performing a simple equation in which we will calculate the result.
So which datatype would be best suitable for an algebraic expression?
Let us see, in our program, we are making use of two different datatypes: int a and float b.
As per Java convention, it is said higher the order of a datatype, the highest preference is given to that datatype.
The value of the result is stored using double datatype. So by default, Java will assume the result to be calculated in double type.
But there is a twist in our program, as we have provided the value of b which is a float type, ending with literal 'f', now our program output will provide a precision equivalent to 7-decimal.
Another scenario where we want our result must be calculated in int type, so how we will do that?
We have to make use of the explicit typecast concept to fulfill our requirements.
In this video tutorial, the steps are mentioned and the instructor had given a complete explanation of how to do it.
Quiz Consists:
Multiple Choice question
True or false Type Question
Practice Program: identify Output.
Please go through all lecture video and resources before attempting the Quiz
This lecture deals with basic operators in java as the addition, subtraction, multiplication, and division operators. (+,-,*,/). In addition to these Operators, it also contains information about the increment(++) operator which increases the value by 1 as contrast to the decrement operator(--) which does exactly the opposite. Modulo operator(%) gives the remainder of two numbers.
Java provides a rich set of operators to manipulate a variable. Operators are the symbols in Java that perform a specific operation on many operands and return the output. Before knowing the arithmetic operators, let us know the type of operator.
Java operators are divided into the following groups:
Arithmetic Operators
Assignment Operators
Bitwise Operators
Logical Operators
Relational Operators
Operators
Arithmetic operator
In this tutorial, we will discuss the arithmetic operator. Mathematical operations are done by using arithmetic operators. The following table displays all the arithmetic operators supported by java. Assume integer variable “A” holds value 5 and variable “B” holds value 10.
Addition Operator
Plus (+) operator is used for the addition of two numbers. In addition to adding two numbers, the addition operator is also used for string concatenation.
Subtraction operator
Minus (-) operator is used for subtracting the second operand from the first.
Multiplication Operator
Multiplication (*) operator used to multiply two numbers.
Division Operator
Division operator (/) used to divide numerator by de-numerator and it gives the quotient.
In the following illustration 12 divided by 2 and the result is 6.
Modulus operator
Modulus operator used to returns the remainder of one number divided by another.
Increment operator
Increment operator is a unary operator that increments its operand by one. This operator can be used for both postfix(x++) as well as a prefix (++x).
Postfix-In the postfix form, it evaluates the value of the operand before the increment operation.
Prefix-In the prefix form it evaluates the value of the operand after the increment operation.
So do you now understood the difference?
In prefix, the value of the variable will get incremented first and then the statement will get executed. Whereas in postfix, the statement will be executed with the current value of the variable and then the value gets incremented
Decrement operator:
Decrement operator is also a unary operator that decrements its operand by one. This operator can be used for both postfix(x--) as well as a prefix (--x).
Postfix-In the postfix form, it evaluates the value of the operand before the decrement operation.
After this tutorial, you will be able to use these operators efficiently in your program.
In this video tutorial, we will take one simple example to define operations using the decision-making concept. All the basic arithmetic operations programs will be provided with an explanation in each of the parts.
This tutorial deals with the 'if' condition. The if condition verifies the basic yes or no condition. If this given condition is satisfied the statements inside the if cases are executed. Or if false the 'else' case is executed(if written or defined). The scope of the if statement and the implementation of this will be discussed further.
In this video tutorial, we will take one simple example to define operations using the decision-making concept. All the basic arithmetic operations programs will be provided with an explanation in each of the parts.
This tutorial is the continuation of the lecture above. In the lecture the implementation of if condition is shown.
This lecture deals with more cases that could be used in if-else condition. The use of &&(and) operator and ||(or) operator for condition checking is used along with !(not) or negation operator. At the end of the lecture, we will be able to use these in our programs efficiently.
This tutorial deals with three operands we use the ternary operator. It can be used as a single-line substitution for the given if-else condition. We can also use it to replace the switch. The basic syntax of the ternary operator along with the rules is shown in the following. At the end of the lecture, we will be able to use these in our programs efficiently.
Ternary Operator In Java
The ternary operator works on three operands. It returns a value based on a condition that evaluates either true or false statements. True and false statements are also an expression that you want to evaluate. If the expression is true it evaluates the expression true otherwise it evaluates the expression false.
The ternary operator is also known as a conditional operator that evaluates a condition of if-then-else. In Java “If” statement is used to make a decision based on a condition that allows testing a condition if the condition is true, the code inside “if block” will be executed, and else statement will execute when a condition is false.
Ternary operator has three operands: Condition? Expression 1: Expression 2
The condition is evaluated.
If the condition is true then Expression1 is returned.
If the condition is false then Expression2 will be returned
The ternary operator allows you to evaluate a Boolean expression that evaluates the true or false expression. If the condition is true then it will evaluate expression true otherwise it evaluates the expression false.
The ternary operator allows to returning of an output based on the relational operator.
Note: If two primitive values are equal you must use the comparison operator “==” not “=”.
Assignment Operators
Assignment operators are a binary operator that is used to assign a value of an expression to a variable on the left-hand side of the operator, with the result of the value on the right-hand side of the equation.
In Java, the assignment operator are as follows: =,+=,-+,*=,/=,%=
The simplest assignment operator is “=” assignment (int x= 1 ;)
Compound assignment operator in java
Besides the simple assignment operator”=” there are also various compound assignment operator. For example, the following statement after the declaration of x is equivalent:
x += 5; // simple assignment operator
x = x+5; // compound assignment operator
x -= 5; // simple assignment operator
x = x-5; // compound assignment operator
x*= 5;// simple assignment operator
x = x*5; // compound assignment operator
x /= 5; // simple assignment operator
x / 5; // compound assignment operator
x %= 5; // simple assignment operator
x = x%5;// compound assignment operator
This tutorial deals with assignment operators in java which provides an easier syntax for assigning a result of arithmetic or bitwise operator. The basic syntax along with the use of 4 assignment operators which are ([+=, -=, *=, /=, %=]) is shown in the program.
Making a decision with IF-Else
In this tutorial, we deal with the advanced details of the if-else condition.
IF Statement
If statement is one of the control flow statement. In Java If statement is used make decision based on condition.
In If statement we test a condition, if the condition is true, the code inside “If block” will be executed and if the condition is false, the code inside if the condition is ignored. Braces “{ }” decides the scope of if statement.
IF-Else Statement
An if statement can be followed by an optional else statement, which executes when the Boolean expression is false.
“If” block would be executed when the condition is true (if x is equal to 5), otherwise “else” block is executed when the condition is false (value of x is greater than 5. Which will execute the ‘else’ block).
The tutorial highlights the errors committed while using if condition also gives insight into the scope of the if, else, and if-else statements. The nested-if condition also described here with various cases and code blocks. At the end of the tutorial, we have a better understanding of if conditions.
These are all the source codes of the programs discussed so far in the section. At the end of each section, we have presented the same.
Quiz Consists:
Multiple Choice question
True or false Type Question
Practice Program: identify Output.
Please go through all lecture videos and resources before attempting the Quiz
The switch case is a more advanced version of else and if-else conditions. The switch case is a multi-way branch statement. We can assign n number of conditions for n cases in short as a contrast to the else and if-else. It also doesn't require code blocks. There are various further uses and details which will be seen further.
Switch Case
Switch case statement in java is the conditional statement that executes one statement out of many statements when the condition is matched. Default statement is executed when none of the conditions is matched.
Switch case always works on condition, switch case is always used with a break statement.
Do you Know?
It is not necessary to write case statements in sequence.
Only int, char, String, and Enum are allowed as switch expression.
This tutorial contains more in-depth information about the switch. The switch condition can only make use of int, char, and enum datatype. (enum is to be seen further- It is a user-defined datatype). The switch conditions have a variety of features as such multiple conditions for the same output. The implementation of the char datatype in the switch case is also shown here.
String as an expression
A String can be used as an expression in a switch statement. This switch statement expression is compared with the expression of each case. This comparison is case sensitive, so we convert all expressions into lower cases.
The following program explanation is provided in the video tutorial.
In this topic, we will make use of string as an expression methodology and try to execute the program using the switch case approach.
This tutorial about the switch case contains information about implementing the switch with String datatype. Also working with functions with String to manipulate the outcome of the program and apply various conditions for the same output is shown.
Program explanation is provided in the tutorial.
This tutorial deals with the implementation of for loop. The for loop deals with executing the code continuously over a given range of values specified by the user.
In a programming language, a loop means repeating the execution to the instruction or instruction block with respect to the condition specified by the programmer.
Types of loops in Java
while loop
for loop
do-while loop
For loop
In Java for loop is used to iterate a part of the statement multiple times until a particular condition is satisfied.
Syntax
for(initialization; condition; increment/decrement)
In the basic structure of for loop, there exist three parts
Initialization of variable
Condition
Variable increment /decrement
Initialization of variable
It initializes the variable which starts the loop. It does not matter how many iterations are present. It executed only once at the beginning of the “for” loop.
Condition
It is used for testing the exit condition and returns the Boolean value true or false if the condition is true the body is executed else the loop terminates without executing the statement loop body.
The condition in the loop doesn’t have any restriction; we can use any condition and any number of comparisons.
Variable increment and decrement
The increase and decrease part of for loop is used for updating the variable for the next iteration.
Note: All of the above is an optional component for a loop.
The further detailed implementation is shown in the next lecture along with implementation for prime numbers.
This tutorial deals with the implementation of a while loop in java. The while loop in java is same as a for loop and used to execute a statement repeatedly until it satisfies the given Boolean condition. It also deals with the condition of an infinite loop which can arise in the while loop.
while loop
while loop in Java is a structure that executes a statement of code multiple times until the boolean expression is false.
In while loop, boolean expression is evaluated before the execution of code. If the boolean expression is evaluated as true, then only the execution of code starts, and if the expression is evaluated as false, the block of code inside while loop will not be executed.
Infinite loop
The boolean expression, that is evaluated before each loop iteration is never modified, so the expression (true) will always evaluate true. The result is, the loop will never end. It is known as an infinite loop.
Difference between for loop and while loop
For loop is used when we know the number of iterations. For example when we are sure that how many times we need to execute a loop.
While loop is used when we are unsure about the number of iteration and want to loop while some condition is true. It will loop that block until the condition is false.
This tutorial deals with the do-while condition in Java programming. In this tutorial, the basic difference in the do-while, while, and for the loop is shown. The do-while loop is a variant of while loop which will execute for at least one time even if the condition is false. Hence this program will explain the concepts of the do-while loop in java.
do...while loop
Java allows you to create a do-while loop, which likes almost similar to a while loop, which is a structure of the repetition control with a termination condition and statements, or block of statement.
Difference between while and do-while loop
In Java While loop, the expression is evaluated at the beginning of the loop and if the expression is evaluated as True then only statements inside the while loop will be executed. So, while loop executes the code block only when the expression is true.
In Java Do While loop, the expression is evaluated at the end of the loop so even if the expression returns false, statements inside the code block will be executed at least once. Observe the semi-colon at the end of while condition’s parenthesis
Note:
Use while loop when a loop might not be executed at all.
Use a do-while loop when the loop is executed at least once.
This tutorial deals with the multi-variable implementation of for loop and the while loop. The implementation of these loops regarding a single boolean condition was discussed earlier. After the completion of this section, users will get a complete reference about various types of loops and their variants along with their implementation.
Break and continue statement
In this tutorial, we will discuss the Break and Continue statement.
Break statement
Sometimes it is required to do terminate the loop, without verifying test expression. In such cases break statement can be used. The break statement normally used with the conditional switch statement and do, while, or for loop statement. The break statement transfers the flow of control out of the current scope.
Continue statements
Sometimes if the programmer wants to skip a few statements inside the loop. In such cases, continue statements are used. Generally, the continue statement ends the current iteration of the loop.
This tutorial deals with an advanced variant of for loop. The use of nested loops arises when we need an iteration over repeated conditions. For example, any operation on a matrix such as a matrix multiplication would require the user to iterate through rows and columns separately. The tutorial also implements the program of pattern printing which is the basic question in competitive programming.
Nested Loop
A nested loop is a loop within a loop, an inner loop within the body of an outer one. In this tutorial, we will learn the syntax for nested loops and understand the examples.
Nesting of loop is used for maintaining a structure where more than one loop can be performed. But using this type of looping structure, sometimes it becomes complex to understand the logic. Everyone who has started learning Java must practice the Nesting of loops in general.
It clarifies the concept of Java and makes a clear understanding of the concept. The inner loop and outer loop concept distinguish the structure of the loop significantly.
Quiz Consists:
Multiple Choice questions.
True or false type questions.
Practice program: Identify output.
Another bonus video lecture made to understand the program sum of digits using decision controls and looping concept.
In this tutorial, we will see a very important topic in Java called Methods. There are various types of methods that are differentiated by the parameters passed or return type etc. In this tutorial parameterized methods and non-parameterized methods, are explained. Parameterized methods are which take any arguments (variables of any data type). These can be passed by reference or value. This will be studied further in the course.
Method in Java
In Java, Method is a block of code, which performs a specific task. It is also known as a function procedure.
"Methods" are blocks of code that can be used repeatedly by the programmer to reduce the complexity (length) of the code. There are various types of methods that are differentiated by the parameters passed or return type etc.
Method declaration has six component:
Modifiers – There are two types of modifiers in java. Access and Non-Access Modifiers
Access Modifiers are which control the scope of the defined function.
Access Modifiers are default, public, private, and protected.
Non-Access Modifiers provide additional features.
There are final, static, transient, synchronized, volatile
The return Type – The return type for the method is always the returned data type and if the return type is void, then it returns nothing.
Method Name – It should be according to the naming convention decided by Java.
Parameters – parameters are for taking input from the user. You can provide a comma-delimited list of parameters, the parameter is optional, you can use empty parenthesis if there is no parameter.
Method body – It is always enclosed between braces “{ }” and contains the code for functionality.
Methods reduce the code size and increase the reusability of the code.
Parameterized Method
This is a way of passing value from the user. Parameterization is also used to define some variables inside the method block.
Using parameterization above example can be written as
The variable step is responsible for the initial value of the loop.
The variable ‘final_value’ is responsible for the final value up to which the loop will execute.
This tutorial deals with parameters and returns types of the methods. The parameters are the variables or arguments passed to the function to be used in our program. The return type is the data type of the variable that is returned to the main function (it is not mandatory since the function can also be invoked from an external function).
Method Parameters & Return Type
Here we will deal with the parameters and return type of the method. Return type parameter which could be a value, object, or any data structure is returned by the method after the completion of its execution. The “return” keyword is used to return a value from a method.
A method can return primitive or non-primitive type value.
A method can return only a single It may or may not contain multiple values.
The “return” keyword ideally is the last statement of the method but it could also feature anywhere in the given code depending upon the code. Once the return statement is executed, the program returns to the code from where the method is called. Code written after the return statement will not be executed, it will give you a compile-time error.
This tutorial deals with the concept of method overloading. Method overloading in simple words is a set of methods that have the same name but should have atleast one of the following parameters which are unique to the method. The parameters are return type, parameters passed, and the sequence of parameters. If methods have any one of the above features which is unique to them then multiple methods can share the same name.
Method Overloading
In Java, Method overloading allows having multiple methods with the same name, if they differ in the number of arguments.
Method overloading can be achieved in the following ways:
Differs in numbers of parameter
Differs in the data type of parameters
Differs in the order of parameters.
Note: Method overloading cannot be achieved by changing the return type.
The above-given properties are verified by certain examples by taking a different number of parameters and also different datatypes for the same method name.
In this tutorial, we will check Method Overloading with the help of simple examples. The following methods will be achieved in the following ways.
Method Overloading with different number of parameter
Method overloading with a different data type of parameter
Method overloading with the difference in order of parameters.
This programming exercise defines all of these methods with a clear explanation of the concept.
Code blocks have been discussed earlier. A code block is a piece of code that is surrounded by curly braces '{}' which mark the start and end of the piece of code.
Indentation is the proper arrangement of the code by tabs or spaces such that the code is readable. It could also be done automatically by the eclipse editor which is shown in the video.
In addition, some tips and tricks about the editor are discussed here.
In simple words class is a user-defined blueprint that contains user-defined variables and methods which can be accessed by entities called objects of the class. The methods and variables in the class are collectively known as the members of the class. The class is an imaginary template for the object. The class is usually used for defining the exact form and nature. The object operated on the data. These are used for depicting real-life objects and scenarios.
Classes Overview
Classes and Objects are the basic building block of Object-Oriented Programming language. The class can be created by using “class” keyword followed by a reference name.
Classes are the blueprint of object creation. Classes are the user-defined implementation of real-life scenarios. A class defines the state and behaviour of an object.
State – It is the property or variables declared inside a class.
Behaviour – It is the functions or methods created inside a class.
Getters and Setters Overview
In Java, Getter and setter methods are used to retrieve and update the private variables. When you hide the implementation of the object of the class from the outer world, you declare them as private. As private members of the class are not accessible from outside the class, so we use the getter and setter method to retrieve and update the values of private members.
We can manually write the getter and setter method for a variable. The setter method is a parameterized method with the return type as void, which is used to update the value. The getter method has a return type that will be the same as the data type of private variable.
This tutorial deals with the getters and setters assigned to a variable. This can be used especially when the variables are private (scope) that is they cannot be accessed outside from the class in which they are defined.
In this tutorial, basic functions are implemented in a class. As discussed earlier the class implements a real-life scenario such as the example above which depicts certain conditions that apply to a Car which is further explained here.
Adding functions to a class
Likewise, the class has properties, it also has functions or methods.
Let us understand the concept practically using an example, we will create a function in the class.
In this code we are validating the car’s behavior on multiple conditions. “run” function will return the behavior according to the applied conditions. Properties of the car are set in a different class.
The tutorial deals with the concept of constructors. Constructors are chunks of code that are used to initialize the variables automatically in the class to any random default value.
A constructor initializes an object as soon as it is created. It is similar to a method. The constructor can be created automatically in Eclipse and more details are described in the tutorial.
Constructor Overview
In Java, Constructor is a special method, which is invoked when an object of the class is created. It is used to initializing the class variables.
There are some rules for construction creation:
A constructor always has the same name as the class name.
A constructor is a special method that does not has any return type
The constructor is of two types
Default constructor
Parameterized constructor
This tutorial deals with the concept of the default constructor. We have seen that the constructor is the first entity which is called when an object is created. Hence if the variables are assigned while they are created then it has the same working as the default constructor when we assign random values to the specific variables.
This works fine unless the user assigns a constructor after which the user has to assign values for each of the variables.
Default Constructor
If you do not have any constructor in your class, Java compiler adds a default constructor to the class during compilation.
We will see more about the constructor with the help of an example. In the following example, we did not use the object of the class to initialize the variable, rather all the variables have been initialized using a constructor.
In Java, when you do not have any constructor in the class, so during execution Java compiler adds one constructor in the class, it is called as default constructor.
The default constructor does not have any parameters. The default constructor is used to providing the default value to instance variables.
As soon as we create the object of a class using the new keyword, the default constructor of the class is invoked.
Default Constructor added by JVM
In the following tutorial we have taken an example, wherein the Smartphone class we do not write any constructor so JVM will add a default constructor in the class, and properties of the Smartphone class will be initialized using this default constructor.
Inheritance is one of the most important OOPS concepts. This concept is important because it deals with assigning the blocks of code which are repeatedly used to a class (base class), and then using the unique properties (methods or variables) which are only used in the respective classes (derived class).
The derived classes such as the Bike, Car, and Truck automatically inherit the variables such as the engine, wheels, seats, etc. from the base class when it inherits from the base class.
Understanding Inheritance
Inheritance is used to store information and manage the information in a hierarchical order. It is the process of defining a new class based on an existing class where a child class acquires the properties of the parent class. The subclass (Child/Derived class) inherits the properties of the parent class, and the class from which the properties are inherited is called a Super Class (Parent class or Base class).
Inheritance allows us to reuse code and improve the reusability in Java application so that a class has to write only the unique features and the rest of the common properties and functionality can be extended by the other class.
Terminology
Super Class- Superclass is a class whose properties and behaviour are used by the child class.
Sub Class- Subclass is a class that inherits the properties of another class.
Reusability- Inheritance allows the reuse of code. When we create a new class and there is already a class that includes some common properties or features that a class has to write. It can be driven to the new class from the existing class by reusing the field and method.
Note: The advantage of Inheritance is that the code that already exists code in a superclass can be reused in a sub/derived class.
This tutorial deals with using the toString method instead of printing each attribute by calling the respective getter. Hence this method is also set by setting to String method from the Source tab in the menu bar. Hence we can print all the attributes by calling the toString method.
Java toString() method
In Java toString() method is used to get a String representation of an object.
We can override the object’s toString() method during implementation. The toString() method of the Object class helps us to return values of the object, so we don't need to write much code.
Inheritance as we have seen models an IS-A relation. For example the Bike IS-A vehicle. The Car IS-A Vehicle.
The composition follows a HAS-A relation. For example, Laptop HAS-A Screen, Laptop HAS-A Ram. This concept will be seen further.
Composition
The composition is the core concept of object-oriented programming. The composition is the design technique to implement a has-a relationship between different types of object/classes. We can use Java inheritance or object composition in Java for code reuse.
Difference between inheritance and composition?
In Java, Inheritance is suitable only when classes are in a relationship. For example Car, Truck Bike are a vehicle and all these vehicles have common features of vehicle class (Superclass). But to represent the engine relationship, we have an alternative to inheritance known as composition.
In inheritance, we can derive some functionality to a subclass of the parent class, in the composition a class reuses the functionality by creating a reference to the object of the class.
For example, A laptop is a composite object containing other objects such as Screen, processor, Ram, Hard drive, Graphics card, Optical drive, and Keyboard. In other words, the laptop object shares a HAS-A relationship with other objects. The laptop is a composition that consists of multiple components and works together as a team to solve a problem. The following components can be simple as well as complex.
In the following list, Screen, RAM, Hard drive, optical drive Keyboard are simple composition.
Screen -> Full HD/HD
Ram-> DDR1/DDR2/DDR3/DDR4
Hard drive-> 500 GB/1 TB/ 2TB
Optical drive-> Single layer/multilayer
Keyboard-> backlit/standard
Processor and graphics card are complex components. There are multiple things involved.
Processor
Brand
Series
Generation
No of Cores
No of threads
Cache memory
Frequency
Graphics card
Brand
Series
Memory
Composition setting up
In inheritance, we deal with the attributes of other classes. Composition studies have a relationship in which we 'inherit' or use objects from other classes.
In the following example, Laptop HAS-A Processor may have many features. Therefore, we inherit the object and then access the attributes through these objects.
In this tutorial, we will study composition example. In Inheritance, we dealt with the attributes of other classes. Composition studies HAS-A relation in which we 'inherit' or use the objects of other classes. For example, Laptop HAS-A Processor may have many features. Hence we inherit the object and then access the attributes through these objects.
Working with composition
As we discussed, the classes inherit the objects of other classes.
This tutorial is a further continuation of the above composition topic. In this topic as discussed the classes inherit the objects of other classes. Hence to access the attributes we need to create the getters to return the object of the classes by the virtue of which we can access the required attribute.
Importance:
By using composition, we can control the visibility of another object for customer classes and reuse only what we need.
The composition allows the creation of backend classes when necessary.
This tutorial deals with the concept of encapsulation.
Encapsulation simply means restricting access to class variables or methods to outside classes or packages.
This is brought into action in order to impose some restrictions on the variables.
Encapsulation
In Java, Encapsulation is the process of binding the class members (variables and methods) into a single unit. It protects the data of the class to be accessed from outside the class.
In Encapsulation, we hide the implementation details from the outer class and provided them the controlled access to the class.
Encapsulation can be achieved by declaring the instance variables as private. However, we can access the private variable through the getter and setter method. setter method used to update ( void setAge() ) and getter method is used to read (int getAge() ) the value of private variable.
In the following example, we demonstrate how to implement encapsulation and the benefits of encapsulation.
Person class has some public properties and these properties can be accessed and modified from the outside classes.
This concept will be studied in detail in forthcoming videos.
This tutorial is in continuation of the previous lecture regarding the same topic. Encapsulation is the restriction implied on the class members so as to restrict their access to outer classes. Here such an example is provided where the outer class cannot initialize other classes with a non-parametrized constructor.
To implement the encapsulation concept, we need to convert the public properties into private, and to get the default value of these variables we need the getter method.
This tutorial deals with the concept of polymorphism. Polymorphism in simple words means to have multiple forms of a single entity.
In the above example when a note8 object call features methods by different scopes (class scope, one of Phone, and one of SamsungNote8) we obtain different outputs. This concept will be studied further.
This is a continuation of the above tutorial. In this tutorial, another such example of the same function depicting a different output when referenced by the object of the different class is shown.
Here the same example as above is taken in an altogether different function outside the main function which has a return type of Phone class.
OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.
Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.
Find this site helpful? Tell a friend about us.
We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.
Your purchases help us maintain our catalog and keep our servers humming without ads.
Thank you for supporting OpenCourser.