This repository includes my Java introductory training works.
I followed the program path Java ile Programlamaya Giriş course by Engin Demiroğ in BTK Akademi.
Introduction to Java:
- helloWorld
- variables
- dataTypes
- conditionalStatements
- conditionalStatementsDemo
- switchStatements
- forLoops
- whileLoops
- doWhileLoops
- arrays
- arraysDemo
- multiDimensionalArrays
- strings
Mini-Projects in Java:
Object Oriented Programming in Java:
- methods
- class
- Classes define the blueprints for objects (instances). A class is a structure that contains properties (fields) and behaviors (methods).
- classDemo
- classesWithAttributes
- encapsulation
- Encapsulation involves grouping the data and methods that manipulate the data within a single unit. Encapsulation restricts the access to certain components, enhancing security and maintainability.
- constructors
- Constructors are methods which are called when an object is created. The constructors are usually used to initialise the fields of a class or perform some initial operations.
- methodOverloading
- inheritance
- The inheritance allows a class to inherit properties and behaviours from another class, promotes the reusability of code.
- inheritanceDemo
- polymorphism
-
There are two types of polymorphism in OOP. Compile-time and run-time polymorphism.
Compile-time polymorphism is overloading, which is made with the same-named method, but has a different parameter list. Return type conversion cannot be done with the same parameter list since the signature of the methods will be the same due to the same parameter list.
The return type cannot be changed with the same parameter list by overloading. Because the signatures of the methods would be exactly the same with the same parameter list.
Run-time polymorphism is overriding, which is made with the same-named base class method in the derived class. The overridden method has the same parameter list. However, it allows us to make different operations.
-
- overriding
- abstractClasses
-
Abstract classes cannot be instantiated on their own.
Abstract classes may contain abstract methods. Subclasses that extend an abstract class must provide implementations for all the abstract methods or be declared as abstract classes themselves.
Abstract classes are often used to define a common interface or behavior that multiple subclasses share. They provide a way to partially implement a class and leave some methods for the subclasses to implement based on their specific needs.
-
- abstractClassesDemo
- interfaces
- Interfaces define a contract that a class must implement, specifying which methods should be included. Multiple implementation of the interfaces in one class is allowed.
- polymorphismWithInterfaces
- interfaceDemo
- composition
-
The static keyword is used to define class-level entities that are shared among all instances of the class. Static members can be called over the class directly, so the object is not necessary to call a static member. The static keyword is often used for the utility elements.
The inner classes are used to organize code, enhance encapsulation, and logically group related classes together. However, the inner classes are not often used to prevent the violation of the single responsibility principle.
-
Packages
Packages are used to organize and structure classes and interfaces into different namespaces. It helps avoid naming conflicts and provides a hierarchical structure to the code. Packages also aid in creating modular and reusable code.
Collections
Collections refer to frameworks or interfaces that are used to store and manipulate groups of objects. They provide a way to work with groups of objects as a single unit.
Exception Handling
Exception handling refers to the mechanism that allows you to handle runtime errors or exceptional conditions that may occur during the execution of a program.
File Operations
File operations refer to performing various tasks related to handling files and directories using classes and methods provided by the Java I/O (Input/Output) API. These operations include tasks like reading from files, writing to files, creating directories, deleting files, checking file existence, and more.
Generics
Generics are used to create classes, interfaces, and methods that can work with any data type. They provide a way to make the code more flexible, reusable, and type-safe by allowing you to write classes and methods that can operate on a variety of data types without sacrificing type safety.
Threading
Threading refers to the concurrent execution of two or more parts of a program, allowing tasks to run in parallel. Threads are the smallest unit of execution within a process and enable programs to perform multiple tasks simultaneously.
Database Programming with JDBC
The Java Database Connectivity (JDBC) concept is an important aspect of Java programming to work with databases in Java applications.
NOTE: The database connection with JDBC needs a JDBC driver. Thus, the driver was added to the "libs/" folder. The compile command may be used as follows.
cmd /c 'javac Main.java && java -cp ".;../lib/mysql-connector-j-8.0.33.jar" Main'
Programming GUI with Swing
-
Screenshots:
-
Screenshots:
-
Screenshots:
-
Screenshots:
-
Screenshots: