ITR Report-1
ITR Report-1
Submitted by
Enrolment No. Name of Student
2200800820 Karpe Aryan Amit
At
Technogrowth Software Solutions Pvt Ltd.
Under Supervision of Mr. Suraj Raskar.
Internship Start Date:1-06-2024 Internship End Date:14-07-2024
Submitted to
CERTIFICATE
This report details the industrial training undertaken by Karpe Aryan Amit,
encompassing Full Stack Development. The training aimed to provide
practical exposure to these crucial areas of programming and software
development. It covered Core Java, Advanced Java, Hibernate, Spring Boot
and Angular.
This abstract provides an overview of the internship training program at
Technogrowth Software Solution Pvt.Ltd., a cutting-edge technology
company focused on innovation and digital solutions. The internship
program aims to bridge the gap between academic learning and real-world
application, providing students with valuable hands-on experience and
exposure to the dynamic tech industry.
The internship training at Technogrowth Software Solution Pvt.Ltd. is
designed to offer participants a comprehensive and immersive learning
experience. Through a structured curriculum and mentorship, interns have
the opportunity to work on live projects, gaining practical insights into the
development and implementation of innovative technological solutions.
Overall, the training equipped valuable knowledge and hands-on
experience, preparing them for a successful career in the software
development industry.
3
TABLE OF CONTENT
4
1. Introduction to Java, it's features and its structure
Introduction to Java:
Java is both simple and powerful. It combines the ease of programming with
the robustness of an industrial-strength programming language, making it an
excellent choice for a wide variety of applications ranging from mobile apps
and enterprise software to large-scale systems and web applications. Its
syntax is heavily influenced by C and C++, which makes it relatively easy
for developers familiar with these languages to learn Java.
Features of Java:
1. Simple: Java's syntax is clear and concise, which reduces the learning
curve and makes it easier to write and maintain code. It eliminates
complex features of C++, such as pointers and operator overloading,
which simplifies development.
2. Object-Oriented: Java is based on the object-oriented programming
(OOP) paradigm, which organizes software design around data, or objects,
rather than functions and logic. This approach promotes code reuse,
scalability, and ease of maintenance.
3. Platform-Independent: One of Java's key strengths is its platform
independence. Java code is compiled into bytecode, which can be
executed on any system that has a JVM, allowing developers to create
cross-platform applications seamlessly.
4. Secure: Java provides a robust security model. It restricts operations that
can compromise system security, such as memory management, and offers
a security manager to define access policies for classes.
5. Robust: Java's strong memory management, exception handling, and
automatic garbage collection mechanisms contribute to its robustness,
minimizing the likelihood of crashes and memory leaks.
6. Multithreaded: Java supports multithreaded programming, allowing
developers to create applications that can perform multiple tasks
simultaneously, enhancing performance and responsiveness.
7. High Performance: Although Java is an interpreted language, the use of
Just-In-Time (JIT) compilers and efficient garbage collection techniques
5
allow Java applications to perform well, often comparable to those written
in native languages like C or C++.
8. Distributed: Java is designed with networking capabilities, making it easy
to work on distributed computing models, where applications are divided
into multiple components that are distributed across different networked
computers.
9. Dynamic: Java is dynamic in nature. It supports dynamic loading of
classes, which means classes can be loaded at runtime as needed, making
the applications more flexible and adaptable.
A basic Java program consists of one or more classes, and the structure is
straightforward. Here’s an example of a simple Java program:
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Class Declaration: The public class Main line declares a class named Main.
In Java, all code must reside within a class. The public keyword is an access
modifier that makes the class accessible to other classes.
Main Method: The public static void main(String[] args) method is the
entry point of any Java application. It’s where the program begins execution.
6
principles of OOP and leveraging Java's features, developers can create
robust, maintainable, and efficient software solutions.
Keywords in Java:
Java has a set of reserved words known as keywords. These keywords have a
predefined meaning in the language and cannot be used for naming variables,
methods, classes, or any other identifiers. Java's keywords form the core
building blocks of its syntax and are integral to the language's structure and
behavior.
Variables in Java:
1. Local Variables:
o Declared inside a method, constructor, or block.
7
o Created when the method, constructor, or block is entered and
destroyed once it is exited.
o Scope is limited to the block in which they are declared.
o Must be initialized before use.
Example:
public void myMethod() {
int localVariable = 10; // Local variable
System.out.println(localVariable);
}
2. Instance Variables:
o Declared inside a class but outside any method, constructor, or
block.
o Created when an object of the class is instantiated and destroyed
when the object is destroyed.
o Each object has its own copy of instance variables.
o Initialized to default values if not explicitly initialized.
Example:
public class MyClass {
int instanceVariable; // Instance variable
}
3. Static Variables:
o Declared with the static keyword inside a class but outside any
method, constructor, or block.
o Created at the start of the program and destroyed at its end.
o Shared among all instances of a class.
o Initialized to default values if not explicitly initialized.
Example:
public class MyClass {
static int staticVariable; // Static variable
}
8
Data Types in Java:
Java provides a rich set of data types to handle various kinds of data. These
data types are categorized into two main types: primitive data types and non-
primitive (or reference) data types.
1. Primitive Data Types: Primitive data types are predefined by the Java
language and serve as the building blocks of data manipulation. There are
eight primitive data types:
o byte: 8-bit signed integer. Range: -128 to 127.
o short: 16-bit signed integer. Range: -32,768 to 32,767.
o int: 32-bit signed integer. Range: -2^31 to 2^31-1.
o long: 64-bit signed integer. Range: -2^63 to 2^63-1.
o float: Single-precision 32-bit floating point. Used for decimal
values.
o double: Double-precision 64-bit floating point. Used for decimal
values.
o char: 16-bit Unicode character. Range: '\u0000' to '\uffff'.
o boolean: Represents one bit of information. Only two possible
values: true and false.
Example:
byte byteVar = 100;
short shortVar = 10000;
int intVar = 100000;
long longVar = 100000L;
float floatVar = 234.5f;
double doubleVar = 123.4;
char charVar = 'A';
boolean booleanVar = true;
Example:
String stringVar = "Hello, World!";
int[] arrayVar = {1, 2, 3, 4, 5};
class MyClass {
9
// Class definition
}
interface MyInterface {
// Interface definition
}
Encapsulation:
Control of the data: By restricting access, you can control how the data
is modified or accessed.
Increased security: Sensitive data can be hidden from unauthorized
access.
Flexibility: The internal implementation can be changed without affecting
other parts of the program.
Maintainability: Makes the code easier to maintain and modify.
Example of encapsulation:
public class Employee {
// Private variables
private String name;
private int age;
private double salary;
Inheritance:
11
Access to parent class members: Subclasses can access public and
protected members of the superclass.
Method Overriding: Subclasses can provide a specific implementation
for a method already defined in its superclass.
Example of inheritance:
// Superclass
public class Animal {
private String name;
// Subclass
public class Dog extends Animal {
public Dog(String name) {
super(name); // Call the constructor of the
superclass
}
4. POJO class
12
A POJO (Plain Old Java Object) is a simple Java object that does not follow
any special conventions or inherit from any special classes other than Java's
built-in Object class. POJOs are used to increase the readability and
reusability of a program by using straightforward and uncluttered code. They
are commonly used in enterprise applications to represent data and
encapsulate business logic.
No special requirements: A POJO does not require any special class path
or configuration. It is a simple Java object that adheres to standard Java
conventions.
Encapsulation: POJOs use private fields and public getter and setter
methods to adhere to the principle of encapsulation.
No constraints: POJOs do not have to implement any interfaces or extend
any specific classes (other than Object).
Lightweight: Since POJOs are free from framework-specific
dependencies, they are lightweight and easy to use in various contexts.
// No-argument constructor
public Student() {
}
13
// Parameterized constructor
public Student(int id, String name, int age, String
grade) {
this.id = id;
this.name = name;
this.age = age;
this.grade = grade;
}
14
return "Student{id=" + id + ", name='" + name + "',
age=" + age + ", grade='" + grade + "'}";
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return
false;
@Override
public int hashCode() {
int result = id;
result = 31 * result + name.hashCode();
result = 31 * result + age;
result = 31 * result + grade.hashCode();
return result;
}
}
While POJOs are simple, they can be enhanced with annotations to work
with various frameworks like Hibernate (for ORM), Spring (for dependency
injection and other services), and JAX-RS (for RESTful web services).
15
These frameworks can automatically detect and process POJOs, enabling
powerful features with minimal configuration.
@Entity
@Table(name = "students")
public class Student {
@Id
private int id;
private String name;
private int age;
private String grade;
Types of Exceptions:
1. Checked Exceptions:
o Checked exceptions are checked at compile-time.
o These exceptions must be either caught or declared in the method
using the throws keyword.
o Examples include IOException, SQLException, and
ClassNotFoundException.
16
2. Unchecked Exceptions:
o Unchecked exceptions are not checked at compile-time, meaning
they occur at runtime.
o These exceptions do not need to be declared or caught.
o Examples include NullPointerException,
ArrayIndexOutOfBoundsException, and
ArithmeticException.
3. Errors:
o Errors are serious issues that a reasonable application should not try
to catch.
o Examples include OutOfMemoryError and
StackOverflowError.
Example:
public class ExceptionExample {
public static void main(String[] args) {
try {
int data = 50 / 0; // This will throw
ArithmeticException
} catch (ArithmeticException e) {
System.out.println("ArithmeticException
caught: " + e.getMessage());
17
} finally {
System.out.println("Finally block
executed");
}
System.out.println("Rest of the code");
}
}
Keyword Description
try The "try" keyword is used to specify a block where we should
place an exception code. It means we can't use try block alone.
The try block must be followed by either catch or finally.
catch The "catch" block is used to handle the exception. It must be
preceded by try block which means we can't use catch block
alone. It can be followed by finally block later.
finally The "finally" block is used to execute the necessary code of the
program. It is executed whether an exception is handled or not.
throw The "throw" keyword is used to throw an exception.
throws The "throws" keyword is used to declare exceptions. It specifies
that there may occur an exception in the method.
Multithreading in Java:
18
Multithreading is a feature in Java that allows concurrent execution of two or
more threads for maximum utilization of the CPU. A thread is a lightweight
sub-process, the smallest unit of processing. Multithreading is used to
perform multiple tasks simultaneously, thus making the application more
efficient.
Benefits of Multithreading:
Creating Threads:
Synchronization:
Example of Synchronization:
class Table {
synchronized void printTable(int n) { // Synchronized
method
for (int i = 1; i <= 5; i++) {
System.out.println(n * i);
try {
Thread.sleep(400);
} catch (InterruptedException e) {
System.out.println(e);
}
}
}
}
MyThread1(Table t) {
this.t = t;
}
MyThread2(Table t) {
this.t = t;
}
6. Collection framework
1. Interfaces:
o Collection: The root interface for all collections. It provides general
methods for adding, removing, and accessing elements.
o List: An ordered collection (also known as a sequence) that allows
duplicate elements. Examples include ArrayList,
LinkedList, and Vector.
o Set: A collection that does not allow duplicate elements. Examples
include HashSet, LinkedHashSet, and TreeSet.
o Queue: A collection used to hold multiple elements prior to
processing, typically in a FIFO (first-in-first-out) order. Examples
include PriorityQueue and LinkedList.
o Deque: A double-ended queue that allows insertion and removal of
elements from both ends. Examples include ArrayDeque.
o Map: An object that maps keys to values, with no duplicate keys
allowed. Examples include HashMap, LinkedHashMap, and
TreeMap.
2. Classes:
o ArrayList: A resizable array implementation of the List
interface.
o LinkedList: A doubly-linked list implementation of the List and
Deque interfaces.
21
o HashSet: A hash table-based implementation of the Set interface.
o TreeSet: A Set implementation that uses a tree for storage,
providing an ordered set.
o HashMap: A hash table-based implementation of the Map
interface.
o TreeMap: A Map implementation that uses a tree for storage,
providing an ordered map.
o PriorityQueue: A priority heap implementation of the Queue
interface.
o ArrayDeque: A resizable array implementation of the Deque
interface.
Example:
List<String> list = new ArrayList<>();
list.add("A");
list.add("B");
list.add("C");
Example:
List<String> stringList = new ArrayList<>();
stringList.add("Hello");
22
stringList.add("World");
Example of Comparable:
@Override
public int compareTo(Student other) {
return this.id - other.id; // Compare based on id
}
}
Example of Comparator:
import java.util.Comparator;
public class NameComparator implements Comparator<Student> {
@Override
public int compare(Student s1, Student s2) {
return s1.getName().compareTo(s2.getName()); //
Compare based on name
}
}
1. ArrayList:
o Dynamic array that allows random access.
o Fast for retrieving elements, slow for adding/removing elements
(except at the end).
Example:
List<String> arrayList = new ArrayList<>();
arrayList.add("Element 1");
arrayList.add("Element 2");
23
2. LinkedList:
o Doubly-linked list implementation.
o Fast for adding/removing elements, slow for random access.
Example:
List<String> linkedList = new LinkedList<>();
linkedList.add("Element 1");
linkedList.add("Element 2");
3. HashSet:
o Unordered collection that does not allow duplicates.
o Fast for adding, removing, and checking for elements.
Example:
Set<String> hashSet = new HashSet<>();
hashSet.add("Element 1");
hashSet.add("Element 2");
4. HashMap:
o Key-value pairs with no duplicate keys.
o Fast for adding, removing, and retrieving elements.
Example:
Map<Integer, String> hashMap = new HashMap<>();
hashMap.put(1, "Value 1");
hashMap.put(2, "Value 2");
7. JDBC
Introduction to JDBC:
1. JDBC API: The API defines a set of interfaces and classes for connecting
to a database, sending SQL queries, and processing the results.
24
2. JDBC Driver: A driver is a software component that implements the
JDBC API for a specific database. It translates JDBC method calls into
database-specific calls.
3. DriverManager: This class manages a list of database drivers and
establishes a connection to a database.
4. Connection: Represents a session with a specific database. SQL
statements are executed and results are returned within the context of a
connection.
5. Statement: Used for executing a static SQL statement and returning the
results it produces.
6. PreparedStatement: A subclass of Statement used to execute
precompiled SQL queries with parameterized inputs.
7. ResultSet: Represents the result set of a query, providing methods to
iterate through the results.
2. Establish a Connection:
o Use the DriverManager.getConnection() method to
establish a connection to the database.
String url = "jdbc:mysql://localhost:3306/mydatabase";
String username = "root";
String password = "password";
Connection connection = DriverManager.getConnection(url,
username, password);
3. Create a Statement:
o Use the createStatement() method of the Connection
object to create a Statement object.
4. Execute a Query:
o Use the executeQuery() method for SELECT queries or
executeUpdate() for INSERT, UPDATE, DELETE, and DDL
statements.
String sql = "SELECT * FROM employees";
25
ResultSet resultSet = statement.executeQuery(sql);
while (resultSet.next()) {
int id = resultSet.getInt("id");
String name = resultSet.getString("name");
double salary = resultSet.getDouble("salary");
System.out.println("ID: " + id + ", Name: " + name + ",
Salary: " + salary);
}
try {
// Load the JDBC driver
Class.forName("com.mysql.cj.jdbc.Driver");
// Establish a connection
Connection connection =
DriverManager.getConnection(url, username, password);
// Create a statement
Statement statement =
connection.createStatement();
// Execute a query
String sql = "SELECT * FROM employees";
26
ResultSet resultSet =
statement.executeQuery(sql);
PreparedStatement:
Example of PreparedStatement:
String sql = "SELECT * FROM employees WHERE department = ?";
PreparedStatement preparedStatement =
connection.prepareStatement(sql);
preparedStatement.setString(1, "Sales");
ResultSet resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
int id = resultSet.getInt("id");
String name = resultSet.getString("name");
double salary = resultSet.getDouble("salary");
System.out.println("ID: " + id + ", Name: " + name + ",
Salary: " + salary);
}
resultSet.close();
preparedStatement.close();
Batch Processing:
27
Batch processing allows you to group multiple SQL statements into a batch
and execute them all at once, which can significantly improve performance.
preparedStatement.close();
Transactions:
statement.executeUpdate(sql1);
statement.executeUpdate(sql2);
28
statement.close();
connection.close();
}
8. Hibernate
Introduction to Hibernate:
1. Configuration Object:
o Represents the configuration or properties file required by
Hibernate.
o Contains information about database dialect, connection details, and
mapping files.
Example:
Configuration cfg = new Configuration();
cfg.configure("hibernate.cfg.xml");
2. SessionFactory:
29
o A thread-safe object used by the application to obtain Session
objects.
o Created once per application and usually instantiated during
application startup.
Example:
SessionFactory factory = cfg.buildSessionFactory();
3. Session:
o A single-threaded, short-lived object representing a conversation
between the application and the database.
o Used to perform CRUD (Create, Read, Update, Delete) operations.
Example:
Session session = factory.openSession();
4. Transaction:
o Represents a unit of work that is atomic in nature. Transactions
ensure data integrity.
o Managed through the Session object.
Example:
Transaction tx = session.beginTransaction();
5. Query:
o Used to execute queries against the database.
o Hibernate provides HQL and criteria queries.
Example:
Query query = session.createQuery("FROM Employee");
List<Employee> list = query.list();
Hibernate Configuration:
To use Hibernate, you need to configure it with the database details and
entity mappings. This configuration is usually done in an XML file named
hibernate.cfg.xml.
Example of hibernate.cfg.xml:
30
"http://hibernate.sourceforge.net/hibernate-
configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property
name="hibernate.dialect">org.hibernate.dialect.MySQLDialect<
/property>
<property
name="hibernate.connection.driver_class">com.mysql.cj.jdbc.D
river</property>
<property
name="hibernate.connection.url">jdbc:mysql://localhost:3306/
mydatabase</property>
<property
name="hibernate.connection.username">root</property>
<property
name="hibernate.connection.password">password</property>
<property
name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.show_sql">true</property>
<property
name="hibernate.format_sql">true</property>
<mapping resource="employee.hbm.xml"/>
</session-factory>
</hibernate-configuration>
An entity class represents a table in the database. The fields of the class
represent the columns of the table. Hibernate uses annotations or XML
mappings to map the class to the table.
@Entity
@Table(name = "employee")
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name = "name")
private String name;
@Column(name = "salary")
private double salary;
31
CRUD Operations with Hibernate:
session.save(emp);
tx.commit();
session.close();
3. Updating a Record:
Session session = factory.openSession();
Transaction tx = session.beginTransaction();
session.update(emp);
tx.commit();
session.close();
4. Deleting a Record:
Session session = factory.openSession();
Transaction tx = session.beginTransaction();
tx.commit();
session.close();
32
Example of HQL:
Session session = factory.openSession();
Query query = session.createQuery("FROM Employee WHERE
salary > :salary");
query.setParameter("salary", 40000);
List<Employee> list = query.list();
session.close();
Criteria Queries:
Criteria API is another way of querying the database using Java objects and
methods instead of HQL strings.
List<Employee> list =
session.createQuery(query).getResultList();
session.close();
9. Spring Boot
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
Example:
import org.springframework.boot.SpringApplication;
import
org.springframework.boot.autoconfigure.SpringBootApplicati
on;
@SpringBootApplication
public class MyApplication {
1. @SpringBootApplication:
o Main annotation to mark a class as a Spring Boot application.
Enables autoconfiguration and component scanning.
2. @RestController:
o Annotation used in Spring MVC to define RESTful controllers.
Combines @Controller and @ResponseBody.
Example:
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api")
public class MyRestController {
@GetMapping("/hello")
public String hello() {
return "Hello, World!";
35
}
}
3. @Autowired:
o Annotation used for automatic dependency injection. Automatically
wires beans by type.
Example:
import
org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MyService {
@RestController
public class MyRestController {
@Autowired
private MyService myService;
@GetMapping("/message")
public String getMessage() {
return myService.getMessage();
}
}
4. Externalized Configuration:
o Spring Boot allows configuration properties to be externalized from
the application code, supporting YAML, properties files, and
environment variables.
Example application.properties:
server.port=8080
myapp.message=Hello, Spring Boot!
@Component
public class MyComponent {
36
@Value("${myapp.message}")
private String message;
Example:
import
org.springframework.data.jpa.repository.JpaRepository;
10. Angular
Introduction to Angular:
1. Installation:
o Angular applications are created and managed using the Angular
CLI. Install Angular CLI globally using npm:
npm install -g @angular/cli
ng new my-angular-app
cd my-angular-app
ng serve --open
5. Creating Services:
o Services in Angular are used for encapsulating reusable business
logic, data fetching, and interaction with external services (like
HTTP requests). Generate a service using the Angular CLI:
ng generate service my-service
@Component({
selector: 'app-my-component',
templateUrl: './my-component.component.html',
styleUrls: ['./my-component.component.css']
})
export class MyComponentComponent {
title = 'Angular Component Example';
message = 'Hello from Angular!';
}
<div>
<h1>{{ title }}</h1>
<p>{{ message }}</p>
</div>
39
3. Component CSS (my-component.component.css):
div {
background-color: #f0f0f0;
padding: 20px;
margin: 20px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
<app-my-component></app-my-component>
40
11.Completion letter/ Certificate:
41
12. Conclusion
42
During my internship at TechnoGrowth Software Solutions Pvt Ltd, I gained
hands-on experience in diverse technologies such as Java, Hibernate, Spring
Boot, and Angular. This internship provided me with practical insights into
software development practices, including database management, API
development, and front-end application building. I greatly appreciate the
guidance and support from the team, which enhanced my technical skills,
problem-solving abilities, and understanding of agile methodologies. This
internship has prepared me for future career opportunities and instilled in me
a commitment to continuous learning and professional growth in software
development.
43