Skip to content
SHShahadat HossainAssistant Professor · DIU

Object-Oriented Programming with Java

From objects and classes to methods, overloading and recursion.
  1. 01OOP Concept: ObjectIn object-oriented programming (OOP), objects are the first thing you think about when making a program, and they are also the units of code that come out of…
  2. 02OOP Concept: ClassA class is a template in object-oriented programming that specifies how to construct objects, what their initial values should be for state (in the form of…
  3. 03Introduction to JavaOracle created the programming language Java in 1995. 3 million Java-powered machines.
  4. 04Installation of JavaSome computers may already have Java installed.
  5. 05SyntaxIn the previous chapter, we created a Java file named Main.java and printed "Hello World" to the screen using the following code:
  6. 06VariablesVariables are containers for storing data values.
  7. 07Data TypesAs explained in the previous chapter, a variable in Java must be a specified data type:
  8. 08Type CastingType casting is when you assign a value of one primitive data type to another type.
  9. 09OperatorsOperators are used to perform operations on variables and values.
  10. 10StringsIt's common practice to save the text in strings.
  11. 11MathThe Java Math class has many methods that allows you to perform mathematical tasks on numbers. The Math.max(x,y) method can be used to find the highest value…
  12. 12BooleansIt's common practice in computer programming to work with data types that accept only binary values, such as:
  13. 13If … ElseJava is compatible with the standard mathematical logical conditions:
  14. 14Switch CaseInstead of writing many if..else statements, you can use the switch statement.
  15. 15LoopsA block of code can be run in a loop as long as a certain condition is met. Loops are helpful because they save time, cut down on mistakes, and make code…
  16. 16ArraysArrays are used to store multiple values in a single variable, instead of declaring separate variables for each value.
  17. 17MethodsMethods are blocks of code that only run when they are called. You can send parameters, which are pieces of data, into a method. Methods are ways to do things,…
  18. 18Method OverloadingWith method overloading, multiple methods can have the same name with different parameters:
  19. 19RecursionRecursion is the process of calling a function from another function. This method gives you a way to break down hard problems into smaller, simpler ones that…
  20. 20Creating and Processing ArraysThe array is a type of data structure in Java that stores a fixed-size collection of elements of the same type in order. An array is a place to store a group…
All course materials