The document provides an overview of core Java basics. It discusses that Java was originally developed by Sun Microsystems and the latest release is Java SE 8. It also explains that Java is object-oriented, platform independent, simple, architecture neutral, portable, robust, multithreaded, interpreted and distributed. The document then discusses Java environment setup, basic syntax including classes, objects and methods. It also covers primitive data types, constructors, OOP concepts like abstraction, encapsulation, inheritance and polymorphism.
Introduction to Java Programming, Basic Structure, variables Data type, input...Mr. Akaash
This is First Lecture of java Programming which cover all basic points (ie. History and feature of java, Introduction to java, about variables data type and compilation....
Previously we had begin with Java Tutorial beginners guide featuring – What is Java , features of Java Programming Language , Java editors and different Java editions and Java Application Types . Now on Java tutorial we begin with the section 2 that is about JVM – Java Virtual Machine . And also about the difference between JDK Vs JRE Vs JVM including other aspects of Java Virtual Machine .
https://maccablo.com/java-virtual-machine-jdk-jre-jvm/
The document provides an overview of the Java programming language and related technologies including servlets, JSP, Struts, Hibernate, and Tiles. It discusses what Java is, its history and technology, the different Java editions, J2EE and its components, how servlets and JSP work, database handling with JDBC, the MVC pattern implemented by Struts, and object relational mapping with Hibernate. Tiles is described as a framework for assembling web pages from individual visual components.
Core Java Tutorial. In case you want to get trained in Spring Framework you can refer here:
<a href="https://www.emexotechnologies.com/courses/java-development-training/core-java-training/">Java Training</a>
This document discusses using a Scanner object in Java to read input from the user. It explains that System.in represents standard input and can be passed to a new Scanner object. Various Scanner methods like nextInt(), nextDouble(), and nextLine() allow retrieving input as different data types. The document provides examples of creating a Scanner, importing it, and using methods like nextInt() and nextLine() to read integer and string user input. It emphasizes the importance of prompts to indicate what type of data the user should enter.
Introduction to JPA and Hibernate including examplesecosio GmbH
In this talk, held as part of the Web Engineering lecture series at Vienna University of Technology, we introduce the main concepts of Java Persistence API (JPA) and Hibernate.
The first part of the presentation introduces the main principles of JDBC and outlines the major drawbacks of JDBC-based implementations. We then further outline the fundamental principles behind the concept of object relation mapping (ORM) and finally introduce JPA and Hibernate.
The lecture is accompanied by practical examples, which are available on GitHub.
Introduction to the Spring Framework:
Generar description
IoC container
Dependency Injection
Beans scope and lifecycle
Autowiring
XML and annotation based configuration
Additional features
Exception is an error event that can happen during the execution of a program and disrupts its normal flow. Java provides a robust and object oriented way to handle exception scenarios, known as Java Exception Handling.
The document provides an overview of key Java concepts including classes, objects, variables, methods, encapsulation, inheritance, polymorphism, constructors, memory management, exceptions, I/O streams, threads, collections, serialization and more. It also includes examples of practical applications and code snippets to demonstrate various Java features.
The document discusses Java programming and provides details about:
1. Java is an object-oriented programming language that is platform independent and allows code to run on any system that supports Java.
2. The document covers Java history, features, platforms, data types, variables, operators, control structures and provides examples of Java programs.
3. Key concepts discussed include classes, objects, inheritance, polymorphism, encapsulation and abstraction in Java.
This document provides an overview of developing a web application using Spring Boot that connects to a MySQL database. It discusses setting up the development environment, the benefits of Spring Boot, basic project structure, integrating Spring MVC and JPA/Hibernate for database access. Code examples and links are provided to help get started with a Spring Boot application that reads from a MySQL database and displays the employee data on a web page.
This document discusses exception handling in Java. It defines exceptions as abnormal conditions that disrupt normal program flow. Exception handling allows programs to gracefully handle runtime errors. The key aspects covered include the exception hierarchy, try-catch-finally syntax, checked and unchecked exceptions, and creating user-defined exceptions.
Introduction to Java Programming Languagejaimefrozr
The document provides an introduction and history of the Java programming language. It discusses that Java was originally developed in 1991 by Sun Microsystems to be portable for consumer electronic devices. The document then summarizes the key capabilities of Java including being a general purpose language that can develop robust applications for desktops, servers, and mobile devices. It also outlines the Java language specifications, application programming interface containing predefined classes, and development tools available. Finally, it explains how Java's use of byte code and the Java Virtual Machine allows it to be highly portable across different operating systems.
The document discusses exception handling in Java. It explains that exceptions represent runtime errors and can be handled using try, catch, and finally blocks. The key exception types are Exception, RuntimeException, and Error. Exception is the superclass of all exceptions and must be caught, while RuntimeException represents programming errors that do not require catching. Error represents very severe errors outside the program's control. The document provides examples of how to throw, catch, and handle different exception types in Java code.
Spring Data is a high level SpringSource project whose purpose is to unify and ease the access to different kinds of persistence stores, both relational database systems and NoSQL data stores.
Mahika Tutorials sharing PPT slide for core java programming language. Go threw this slide and visit our YouTube page too
https://www.youtube.com/c/mahikatutorials
Spring Boot is a framework for creating stand-alone, production-grade Spring based applications that can be "just run". It aims to provide a radically faster and widely accessible starting experience for developing Spring applications. Spring Boot applications can be started using java -jar or traditional WAR deployments and require very little Spring configuration. The document then discusses system requirements, development environment, creating a simple Hello World application, using Spring Boot Admin to monitor applications, configuring databases, Spring Data JPA, REST controllers, caching with EhCache, building web applications with Thymeleaf, and project structure.
The document is a presentation on lambda expressions in Java 8 given by Isaac Carter. It introduces lambda expressions and functional programming concepts in Java 8 such as functional interfaces, streams, and method references. It provides examples of using lambda expressions with common Java 8 APIs like forEach(), Predicate, and stream(). The presentation emphasizes thinking declaratively rather than imperatively in Java 8 and leveraging lambda expressions to let Java do more of the work.
Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...Edureka!
** Java Certification Training: https://www.edureka.co/java-j2ee-soa-... **
This Edureka PPT on “Java Tutorial For Beginners” will give you a brief insight about Java and its various fundamental concepts along with their practical implementation. Through this tutorial, you will learn the following topics:
1. Introduction to Java
2. JVM vs JRE vs JDK
3. Java Fundamentals
4. Objects & Classes
5. Methods & Access Modifiers
6. Flow Of Control
7. Java Arrays
- The document provides an introduction to Java programming including an overview of Java, its history, platforms, architecture, components, applications, features, and setting up Java.
- It describes Java as a simple, general-purpose, object-oriented language that is architecture neutral, portable, robust and secure.
- The document outlines the key components of Java including the Java Virtual Machine (JVM), Java Runtime Environment (JRE), and Java Development Kit (JDK).
Java was created in 1991 by James Gosling, Mike Sheridan, and Patrick Naughton at Sun Microsystems. It has three editions: Java ME for limited devices, Java SE as the core platform for desktops and servers, and Java EE for large enterprise applications. Java code is compiled into bytecode that runs on a Java Virtual Machine (JVM) making Java portable across platforms. Key principles of Java include being object-oriented, secure, and platform independent.
The document discusses the fundamentals of object-oriented programming and Java. It covers key concepts like abstraction, encapsulation, inheritance and polymorphism. It also describes the basic structure of a Java program, including classes, objects, methods and variables. It explains how to set up a Java development environment, compile and run a simple Java program.
This document provides an overview of object-oriented programming concepts in Java including abstraction, encapsulation, inheritance, and polymorphism. It discusses key Java concepts like classes, objects, methods, and access specifiers. It also covers Java fundamentals like variables, data types, operators, control flow statements, comments, and arrays. Additionally, it describes the Java runtime environment, how to set up a Java development environment, compile and run a simple Java program. The document is intended as an introduction to object-oriented programming and the Java programming language.
Java-1st.pptx about Java technology before oopsbuvanabala
The document provides an overview of Java programming concepts including:
- What a computer program is and how it is executed by a computer.
- Key differences between Java and other technologies such as its cross-platform capabilities and memory management.
- The basic steps to compile and execute a Java program from the command line.
- Important concepts like case sensitivity, naming conventions, and the main method that is required for all Java programs.
- The different phases a Java program goes through and key components like the JVM, JRE, and JDK.
- Java features like portability, security, and multi-threading capabilities.
- Java's primitive data types and type casting between
Java is an object-oriented programming language that is platform independent. It was developed by Sun Microsystems, now owned by Oracle. Java code is compiled into bytecode that runs on a Java Virtual Machine (JVM), allowing it to run on any device that supports a JVM. Java supports features like inheritance, polymorphism, and encapsulation. It is widely used for client-side applications like applets and server-side applications like servlets and Java Server Pages (JSP). The main Java editions are Java SE for desktop applications, Java EE for enterprise applications, and Java ME for mobile applications.
Java is an object-oriented programming language that is platform independent. It was developed by Sun Microsystems, now owned by Oracle. Java code is compiled into bytecode that runs on a Java Virtual Machine (JVM), allowing it to run on any device with a JVM. Java supports features like inheritance, polymorphism, and encapsulation. It is widely used for client-side applications like applets and server-side applications like servlets and Java Server Pages (JSP). The main Java editions are Java SE for desktop applications, Java EE for enterprise applications, and Java ME for mobile applications.
The document provides an overview of object-oriented programming in Java. It discusses that Java was created to be portable and platform independent due to issues with C/C++. It then covers the history and evolutions of Java, the different Java editions, and defines Java as a general-purpose, object-oriented language. The document compares Java to C/C++ by outlining features removed or added in Java. It also describes characteristics of Java like being simple, robust, secure, portable, and platform independent. Finally, it discusses the Java environment, an example Hello World program, input/output in Java, and primitive data types.
Java is an object-oriented programming language originally developed by Sun Microsystems. There are four main types of Java applications: standalone, web, enterprise, and mobile. The key features of Java include being platform independent, secure, robust, and distributed. Java code is compiled into bytecode that runs on a Java Virtual Machine (JVM) on any device. The JVM performs tasks like loading code, memory management, and execution. There are various data types in Java including primitives like int and double, and reference types like classes. Variables are used to store and reference values in memory and can be local, instance, or class variables. Arrays provide a way to store multiple values of the same type.
This document provides an overview of the Java programming language and environment. It discusses that Java is both a programming language and platform, and describes some of Java's key characteristics like being object-oriented, platform independent, secure, robust and high performance. It also outlines the different types of applications that can be created in Java, such as standalone, web, enterprise and mobile applications. The document concludes by explaining the basic steps to compile and run a simple Java program, and some modifications that can be made to the main method.
The document is a lab manual for Java programming that includes 12 experiments. The first experiment involves creating a Java package with Stack and Queue classes that demonstrate LIFO and FIFO principles respectively using methods like push(), pop() and enqueue(), dequeue(). The second experiment involves designing a ComplexNumber class with constructors to perform addition, subtraction and multiplication of complex numbers.
This document provides an overview of Java including its history, versions, key features, and basic programming concepts. It describes how Java was originally called Oak and later renamed to Java in 1995. It also lists the main Java versions from 1995 to 2011. Additionally, it defines Java as a platform independent language and outlines some of its common uses. The document proceeds to explain Java's main features such as being simple, object-oriented, platform independent, secure, portable, dynamic, high performance, and multithreaded. It also includes examples of a simple Java program, variables, and packages.
This document provides an overview of Java including its origins from C and C++, how it achieves platform independence through bytecode compilation, and key features such as being object-oriented, garbage collected, robust, secure, extensible, and well-understood. It also discusses object-oriented programming concepts in Java like encapsulation, polymorphism through method overloading and overriding, and the importance of Java for internet applications like applets.
This document provides an overview of object-oriented programming concepts in Java. It discusses what software and programs are, and describes different programming languages including machine language, assembly language, and high-level languages like Java. It then covers object-oriented programming concepts like classes, objects, encapsulation, inheritance, polymorphism, and dynamic binding. The document also discusses the history and development of the Java programming language, its key features like being simple, secure, portable, and its uses in applications.
This document provides an overview of Java programming concepts including:
- Java is an object-oriented programming language that allows writing programs as console applications or applets.
- It discusses Java features like being simple, object-oriented, robust, secure, portable, and supports multithreading.
- Key Java concepts covered are data types, keywords, classes, objects, inheritance, polymorphism and exceptions.
- It also discusses the Java virtual machine architecture, class files, and the basic structure of a Java program.
The document discusses Java programming. It provides an overview of Java, including that it is a platform-independent, object-oriented language. It also lists some key advantages of Java such as being simple, secure, portable, and able to perform tasks simultaneously through multithreading. The document then gives examples of basic Java programs and components such as main methods, identifiers, variables, and arrays.
The document discusses Java programming. It covers what Java is, the advantages of learning Java including being object oriented, platform independent, simple, secure, and robust. It also discusses Java tools needed, how to write the first Java program, Java identifiers, modifiers, variables, arrays, enums, and keywords.
This document provides an introduction to Java programming concepts including:
- Java is both a programming language and platform that is simple, architecture neutral, object-oriented, and portable.
- Java source code is written in .java files and compiled into .class files by javac before being executed by the Java Virtual Machine (JVM).
- The JVM allows Java programs to run on any platform without recompilation, providing platform independence.
- Key Java concepts covered include objects, classes, methods, variables, data types, operators, control flow, and arrays.
- Examples demonstrate how to write, compile, and run simple Java programs to illustrate these core programming concepts.
Java is a widely used programming language that is mainly used for application programming. It is platform-independent and supports features like multi-threading and documentation comments. The key aspects of a simple Java program are that it must contain a class with a main method that can be the starting point of execution. The main method has a specific signature of public static void main(String[] args). When a Java program is run, the JVM (Java Virtual Machine) loads and executes the program by performing operations like loading code, verifying code, and providing a runtime environment.
Is Email Marketing Really Effective In 2024?Rakesh Jalan
Slide 1
Is Email Marketing Really Effective in 2024?
Yes, Email Marketing is still a great method for direct marketing.
Slide 2
In this article we will cover:
- What is Email Marketing?
- Pros and cons of Email Marketing.
- Tools available for Email Marketing.
- Ways to make Email Marketing effective.
Slide 3
What Is Email Marketing?
Using email to contact customers is called Email Marketing. It's a quiet and effective communication method. Mastering it can significantly boost business. In digital marketing, two long-term assets are your website and your email list. Social media apps may change, but your website and email list remain constant.
Slide 4
Types of Email Marketing:
1. Welcome Emails
2. Information Emails
3. Transactional Emails
4. Newsletter Emails
5. Lead Nurturing Emails
6. Sponsorship Emails
7. Sales Letter Emails
8. Re-Engagement Emails
9. Brand Story Emails
10. Review Request Emails
Slide 5
Advantages Of Email Marketing
1. Cost-Effective: Cheaper than other methods.
2. Easy: Simple to learn and use.
3. Targeted Audience: Reach your exact audience.
4. Detailed Messages: Convey clear, detailed messages.
5. Non-Disturbing: Less intrusive than social media.
6. Non-Irritating: Customers are less likely to get annoyed.
7. Long Format: Use detailed text, photos, and videos.
8. Easy to Unsubscribe: Customers can easily opt out.
9. Easy Tracking: Track delivery, open rates, and clicks.
10. Professional: Seen as more professional; customers read carefully.
Slide 6
Disadvantages Of Email Marketing:
1. Irrelevant Emails: Costs can rise with irrelevant emails.
2. Poor Content: Boring emails can lead to disengagement.
3. Easy Unsubscribe: Customers can easily leave your list.
Slide 7
Email Marketing Tools
Choosing a good tool involves considering:
1. Deliverability: Email delivery rate.
2. Inbox Placement: Reaching inbox, not spam or promotions.
3. Ease of Use: Simplicity of use.
4. Cost: Affordability.
5. List Maintenance: Keeping the list clean.
6. Features: Regular features like Broadcast and Sequence.
7. Automation: Better with automation.
Slide 8
Top 5 Email Marketing Tools:
1. ConvertKit
2. Get Response
3. Mailchimp
4. Active Campaign
5. Aweber
Slide 9
Email Marketing Strategy
To get good results, consider:
1. Build your own list.
2. Never buy leads.
3. Respect your customers.
4. Always provide value.
5. Don’t email just to sell.
6. Write heartfelt emails.
7. Stick to a schedule.
8. Use photos and videos.
9. Segment your list.
10. Personalize emails.
11. Ensure mobile-friendliness.
12. Optimize timing.
13. Keep designs clean.
14. Remove cold leads.
Slide 10
Uses of Email Marketing:
1. Affiliate Marketing
2. Blogging
3. Customer Relationship Management (CRM)
4. Newsletter Circulation
5. Transaction Notifications
6. Information Dissemination
7. Gathering Feedback
8. Selling Courses
9. Selling Products/Services
Read Full Article:
https://digitalsamaaj.com/is-email-marketing-effective-in-2024/
Join educators from the US and worldwide at this year’s conference, themed “Strategies for Proficiency & Acquisition,” to learn from top experts in world language teaching.
(T.L.E.) Agriculture: Essentials of GardeningMJDuyan
(𝐓𝐋𝐄 𝟏𝟎𝟎) (𝐋𝐞𝐬𝐬𝐨𝐧 𝟏.𝟎)-𝐅𝐢𝐧𝐚𝐥𝐬
Lesson Outcome:
-Students will understand the basics of gardening, including the importance of soil, water, and sunlight for plant growth. They will learn to identify and use essential gardening tools, plant seeds, and seedlings properly, and manage common garden pests using eco-friendly methods.
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894PECB
As artificial intelligence continues to evolve, understanding the complexities and regulations regarding AI risk management is more crucial than ever.
Amongst others, the webinar covers:
• ISO/IEC 42001 standard, which provides guidelines for establishing, implementing, maintaining, and continually improving AI management systems within organizations
• insights into the European Union's landmark legislative proposal aimed at regulating AI
• framework and methodologies prescribed by ISO/IEC 23894 for identifying, assessing, and mitigating risks associated with AI systems
Presenters:
Miriama Podskubova - Attorney at Law
Miriama is a seasoned lawyer with over a decade of experience. She specializes in commercial law, focusing on transactions, venture capital investments, IT, digital law, and cybersecurity, areas she was drawn to through her legal practice. Alongside preparing contract and project documentation, she ensures the correct interpretation and application of European legal regulations in these fields. Beyond client projects, she frequently speaks at conferences on cybersecurity, online privacy protection, and the increasingly pertinent topic of AI regulation. As a registered advocate of Slovak bar, certified data privacy professional in the European Union (CIPP/e) and a member of the international association ELA, she helps both tech-focused startups and entrepreneurs, as well as international chains, to properly set up their business operations.
Callum Wright - Founder and Lead Consultant Founder and Lead Consultant
Callum Wright is a seasoned cybersecurity, privacy and AI governance expert. With over a decade of experience, he has dedicated his career to protecting digital assets, ensuring data privacy, and establishing ethical AI governance frameworks. His diverse background includes significant roles in security architecture, AI governance, risk consulting, and privacy management across various industries, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: June 26, 2024
Tags: ISO/IEC 42001, Artificial Intelligence, EU AI Act, ISO/IEC 23894
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
Integrated Marketing Communications (IMC)- Concept, Features, Elements, Role of advertising in IMC
Advertising: Concept, Features, Evolution of Advertising, Active Participants, Benefits of advertising to Business firms and consumers.
Classification of advertising: Geographic, Media, Target audience and Functions.
How to Configure Time Off Types in Odoo 17Celine George
Now we can take look into how to configure time off types in odoo 17 through this slide. Time-off types are used to grant or request different types of leave. Only then the authorities will have a clear view or a clear understanding of what kind of leave the employee is taking.
How to Show Sample Data in Tree and Kanban View in Odoo 17Celine George
In Odoo 17, sample data serves as a valuable resource for users seeking to familiarize themselves with the functionalities and capabilities of the software prior to integrating their own information. In this slide we are going to discuss about how to show sample data to a tree view and a kanban view.
Slide Presentation from a Doctoral Virtual Open House presented on June 30, 2024 by staff and faculty of Capitol Technology University
Covers degrees offered, program details, tuition, financial aid and the application process.
No, it's not a robot: prompt writing for investigative journalismPaul Bradshaw
How to use generative AI tools like ChatGPT and Gemini to generate story ideas for investigations, identify potential sources, and help with coding and writing.
A talk from the Centre for Investigative Journalism Summer School, July 2024
Views in Odoo - Advanced Views - Pivot View in Odoo 17Celine George
In Odoo, the pivot view is a graphical representation of data that allows users to analyze and summarize large datasets quickly. It's a powerful tool for generating insights from your business data.
The pivot view in Odoo is a valuable tool for analyzing and summarizing large datasets, helping you gain insights into your business operations.
Principles of Roods Approach!!!!!!!.pptxibtesaam huma
Principles of Rood’s Approach
Treatment technique used in physiotherapy for neurological patients which aids them to recover and improve quality of life
Facilitatory techniques
Inhibitory techniques
Front Desk Management in the Odoo 17 ERPCeline George
Front desk officers are responsible for taking care of guests and customers. Their work mainly involves interacting with customers and business partners, either in person or through phone calls.
2. Java – Overview
– Java programming language was originally developed by Sun Microsystems
which was initiated by James Gosling and released in 1995 as core component
of Sun Microsystems' Java platform (Java 1.0 [J2SE]).
– The latest release of the Java Standard Edition is Java SE 8. With the
advancement of Java and its widespread popularity, multiple configurations
were built to suit various types of platforms. For example: J2EE for Enterprise
Applications, J2ME for Mobile Applications.
– The new J2 versions were renamed as Java SE, Java EE, and Java ME
respectively. Java is guaranteed to be Write Once, Run Anywhere.
3. Java is:
– Object Oriented: In Java, everything is an Object. Java can be easily extended
since it is based on the Object model.
– Platform Independent: Unlike many other programming languages including
C and C++, when Java is compiled, it is not compiled into platform specific
machine, rather into platform independent byte code. This byte code is
distributed over the web and interpreted by the Virtual Machine (JVM) on
whichever platform it is being run on.
– Simple: Java is designed to be easy to learn. If you understand the basic
concept of OOP Java, it would be easy to master.
4. – Architecture-neutral: Java compiler generates an architecture-neutral object file format, which makes the
compiled code executable on many processors, with the presence of Java runtime system.
– Portable: Being architecture-neutral and having no implementation dependent aspects of the specification makes
Java portable. Compiler in Java is written in ANSI C with a clean portability boundary, which is a POSIX subset.
– Robust: Java makes an effort to eliminate error prone situations by emphasizing mainly on compile time error
checking and runtime checking.
– Multithreaded: With Java's multithreaded feature it is possible to write programs that can perform many tasks
simultaneously. This design feature allows the developers to construct interactive applications that can run
smoothly.
– Interpreted: Java byte code is translated on the fly to native machine instructions and is not stored anywhere.
The development process is more rapid and analytical since the linking is an incremental and light-weight process.
– High Performance: With the use of Just-In-Time compilers, Java enables high performance.
5. – Distributed: Java is designed for the distributed environment of the internet.
– Dynamic: Java is considered to be more dynamic than C or C++ since it is
designed to adapt to an evolving environment. Java programs can carry
extensive amount of run-time information that can be used to verify and
resolve accesses to objects on run-time.
6. Java - Environment Setup
– Assuming you have installed Java in c:Program Filesjavajdk directory:
– Right-click on 'My Computer' and select 'Properties‘ Advanced System
Settings.
– Click the 'Environment variables' button under the 'Advanced' tab.
– Now, alter the 'Path' variable so that it also contains the path to the Java
executable.
– Example, if the path is currently set to 'C:WINDOWSSYSTEM32', then update
your path to read 'C:WINDOWSSYSTEM32;c:Program Filesjavajdkbin'.
7. Java – Basic Syntax
– When we consider a Java program, it can be defined as a collection of objects that
communicate via invoking each other's methods.
– Object - Objects have states and behaviors. Example: A dog has states - color, name,
breed as well as behavior such as wagging their tail, barking, eating. An object is an
instance of a class.
– Class - A class can be defined as a template/blueprint that describes the
behavior/state that the object of its type supports.
– Methods - A method is basically a behavior. A class can contain many methods. It is
in methods where the logics are written, data is manipulated and all the actions are
executed.
8. First Java Program
– Save the file as: MyFirstJavaProgram.java.
public class MyFirstJavaProgram {
/* This is my first java program.
* This will print 'Hello World' as the output
*/
public static void main(String []args) {
System.out.println("Hello World"); // prints Hello World
}
}
10. Program Execution
Compile Java Program From Command Prompt
– C:> javac MyFirstJavaProgram.java
– C:> java MyFirstJavaProgram
O/P: Hello World
Compilation and execution of a Java program is two step process. During
compilation phase Java compiler compiles the source code and generates
bytecode. This intermediate bytecode is saved in form of a .class file. In second
phase, Java virtual machine (JVM) also called Java interpreter takes the .class as
input and generates output by executing the bytecode
11. Difference between JDK, JRE and JVM
– JVM
– JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime
environment in which java bytecode can be executed.
– JVMs are available for many hardware and software platforms. JVM, JRE and JDK are platform
dependent because configuration of each OS differs. But, Java is platform independent.
– The JVM performs following main tasks:
– Loads code
– Verifies code
– Executes code
– Provides runtime environment
12. – JRE
– JRE is an acronym for Java Runtime Environment.It is used to provide runtime
environment.It is the implementation of JVM. It physically exists. It contains set
of libraries + other files that JVM uses at runtime.
13. – JDK
– JDK is an acronym for Java Development Kit.It physically exists.It contains JRE +
development tools.
17. byte
– byte:
– This can hold whole number between -128 and 127. Mostly used to save
memory and when you are certain that the numbers would be in the limit
specified by byte data type.
Default size of this data type: 1 byte.
Default value: 0
18. – class JavaExample {
– public static void main(String[] args) {
–
– byte num;
– num = 113;
– System.out.println(num);
– }
– }
19. short
– short:
– This is greater than byte in terms of size and less than integer. Its range is -
32,768 to 32767.
Default size of this data type: 2 byte
20. – class JavaExample {
– public static void main(String[] args) {
–
– short num = 45678;;
– System.out.println(num);
– }
– }
21. int
– int: Used when short is not large enough to hold the number, it has a wider
range: -2,147,483,648 to 2,147,483,647
Default size: 4 byte
Default value: 0
Example:
22. – class JavaExample {
– public static void main(String[] args) {
–
– int num = 45678;;
– System.out.println(num);
– }
– }
23. long:
– Used when int is not large enough to hold the value, it has wider range than int
data type, ranging from -9,223,372,036,854,775,808 to
9,223,372,036,854,775,807.
size: 8 bytes
Default value: 0
Example:
24. – class JavaExample {
– public static void main(String[] args) {
–
– long num = -12332252626L;
– System.out.println(num);
– }
– }
32. OOPs (Object Oriented
Programming System)
Object-oriented programming System(OOPs) is a programming paradigm
based on the concept of “objects” that contain data and methods. The primary purpose of object-
oriented programming is to increase the flexibility and maintainability of programs. Object oriented
programming brings together data and its behaviour(methods) in a single location(object) makes it
easier to understand how a program works. We will cover each and every feature of OOPs in detail
so that you won’t face any difficultly understanding OOPs Concepts.
33. OOPs Concepts
– What is an Object
– What is a class
– Constructor in Java
– Object Oriented Programming Features
I. Abstraction
II. Encapsulation
III. Inheritance
IV. Polymorphism
– Abstract Class and Methods
– Interfaces in Java
36. What is a class
– A class is a template or blueprint that is used to create objects.
– Class representation of objects and the sets of operations that can be applied to such objects.
– Class consists of Data members and methods.
– Primary purpose of a class is to held data/information. This is achieved with attributes which is also
known as data members.
– Example:
37. – A class in Java can contain:
1. fields
2. Constructors
3. static blocks
4. Methods
5. instances
38. Example of class
– public class MyFirstJavaExample{
– int a;
– int b;
–
– public int add() {
– //Write code here
– }
– public int sub() {
– //Write code here
– }
– ...
– ...
– }
41. Basic Syntax
– About Java programs, it is very important to keep in mind the following points.
– Case Sensitivity - Java is case sensitive, which means identifier Hello and hello would have different meaning in Java.
– Class Names - For all class names the first letter should be in Upper Case. If several words are used to form a name of the
class, each inner word's first letter should be in Upper Case.
– Example: class MyFirstJavaClass
– Method Names - All method names should start with a Lower Case letter. If several words are used to form the name of
the method, then each inner word's first letter should be in Upper Case.
– Example: public void myMethodName()
– Program File Name - Name of the program file should exactly match the class name. When saving the file, you should save
it using the class name (Remember Java is case sensitive) and append '.java' to the end of the name (if the file name and
the class name do not match, your program will not compile). Example: Assume 'MyFirstJavaProgram' is the class name.
Then the file should be saved as 'MyFirstJavaProgram.java'
42. Types of Variable
– There are three types of variables in java:
1. local variable
2. instance variable
3. static variable
43. – Local variables: Variables defined inside methods, constructors or blocks are
called local variables. The variable will be declared and initialized within the
method and the variable will be destroyed when the method has completed.
– Instance variables: Instance variables are variables within a class but outside
any method. These variables are initialized when the class is instantiated.
Instance variables can be accessed from inside any method, constructor or
blocks of that particular class.
44. – Class variables: Class variables are variables declared within a class, outside any
method, with the static keyword.
– class A{
– int data=50;//instance variable
– static int m=100;//static variable
– void method(){
– int n=90;//local variable
– }
– }//end of class
45. Java Language Keywords
– Here is a list of keywords in the Java programming language. You cannot use any
of the following as identifiers in your programs. The keywords const and goto
are reserved, even though they are not currently used. true, false, and null
might seem like keywords, but they are actually literals; you cannot use them as
identifiers in your programs.
46. abstract continue for new switch
assert*** default goto* package synchronized
boolean do if private this
break double implements protected throw
byte else import public throws
case enum**** instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp** volatile
const* float native super while
* not used
47. Constructor in Java
– Constructor in java is a special type of method that is used to initialize the
object.
– Java constructor is invoked at the time of object creation. It constructs the
values i.e. provides data for the object that is why it is known as constructor.
48. Rules for creating java constructor
– here are basically two rules defined for the constructor.
1. Constructor name must be same as its class name
2. Constructor must have no explicit return type
49. Types of java constructors
– There are two types of constructors:
1. Default constructor (no-arg constructor)
2. Parameterized constructor
52. Difference between constructor
and method in java
Java Constructor Java Method
Constructor is used to initialize the state of
an object.
Method is used to expose behaviour of an
object.
Constructor must not have return type. Method must have return type.
Constructor is invoked implicitly. Method is invoked explicitly.
The java compiler provides a default
constructor if you don't have any
constructor.
Method is not provided by compiler in any
case.
Constructor name must be same as the class
name.
Method name may or may not be same as
class name.
53. Java – Static Class, Block,
Methods and Variables
– In a class we can have
1. static variables
2. static methods
3. static blocks of code.
54. static variables
– It is a variable which belongs to the class and not to object(instance)
– Static variables are initialized only once , at the start of the execution . These
variables will be initialized first, before the initialization of any instance
variables
– A single copy to be shared by all instances of the class
– A static variable can be accessed directly by the class name and doesn’t need
any object
– Syntax : <class-name>.<variable-name>
55. – public class StaticExample {
– static int num;
– static String mystr;
– static{
– num = 97;
– mystr = "Static keyword in Java";
– }
– public static void m1(){
– System.out.println("in m1 methode");
– }
56. Static block
– The static block, is a block of statement inside a Java class that will be executed
when a class is first loaded in to the JVM
– class Test{
– static {
– //Code goes here
– }
– }
57. – public class StaticExample {
– static int num;
– static String mystr;
– static{
– num = 97;
– mystr = "Static keyword in Java";
– }
– }
60. Different types of methods in java
1. static methods
2. Non-static methods/instance methods
Public Class StaticExp{
public static void add(){
}
}
61. Java Static Method
– It is a method which belongs to the class and not to the object(instance)
– A static method can access only static data. It can not access non-static data
(instance variables)
– A static method can call only other static methods and can not call a non-static
method from it.
– A static method can be accessed directly by the class name and doesn’t need
any object
– Syntax : <class-name>.<method-name>
– A static method cannot refer to "this" or "super" keywords in anyway
62. Instance methods
– Methods and variables that are not declared as static are known as instance
methods and instance variables. To refer to instance methods and variables, you
must instantiate the class first means you should create an object of that class
first.For static you don't need to instantiate the class u can access the methods and
variables with the class name
– Example
– Public Class Persion{
– Public void add(){
– }
– }
63. – Person person1 = new Person(); //instantiating
– person1.add(); //accessing non-static method.
64. Inheritance in Java
– Inheritance in java is a mechanism in which one object acquires all the
properties and behaviors of parent object.
– The idea behind inheritance in java is that you can create new classes that are
built upon existing classes. When you inherit from an existing class, you can
reuse methods and fields of parent class, and you can add new methods and
fields also.
– Inheritance represents the IS-A relationship, also known as parent-child
relationship
67. JAVA will not support
Multiple,Hybrid In inheritance
68. Syntax of Java Inheritance
– class Subclass-name extends Superclass-name
– {
– //methods and fields
– }
69. Why multiple inheritance is not
supported in java?
– To reduce the complexity and simplify the language, multiple inheritance is not
supported in java.
– Consider a scenario where A, B and C are three classes. The C class inherits A
and B classes. If A and B classes have same method and you call it from child
class object, there will be ambiguity to call method of A or B class.
– Since compile time errors are better than runtime errors, java renders compile
time error if you inherit 2 classes. So whether you have same method or
different, there will be compile time error now.
71. class C extends A,B{//suppose if it were
•
• Public Static void main(String args[]){
• C obj=new C();
• obj.msg();//Now which msg() method would be invoked?
•}
•}
72. This keyword in java
– There can be a lot of usage of java this keyword. In java, this is a reference
variable that refers to the current object.
73. Usage of java this keyword
– Here is given the 6 usage of java this keyword.
– this can be used to refer current class instance variable.
– this can be used to invoke current class method (implicitly)
– this() can be used to invoke current class constructor.
– this can be passed as an argument in the method call.
– this can be passed as argument in the constructor call.
– this can be used to return the current class instance from the method.
74. this: to refer current class
instance variable
– The this keyword can be used to refer current class instance variable. If there is
ambiguity between the instance variables and parameters, this keyword
resolves the problem of ambiguity
75. Understanding the problem
without this keyword
– class Student{
– int rollno;
– String name;
– float fee;
– Student(int rollno,String name,float fee){
– rollno=rollno;
– name=name;
– fee=fee;
– }
77. Solution of the above problem
by this keyword
– class Student{
– int rollno;
– String name;
– float fee;
– Student(int rollno,String name,float fee){
– this.rollno=rollno;
– this.name=name;
– this.fee=fee;
– }
– void display(){System.out.println(rollno+" "+name+" "+fee);}
– }
78. this: to invoke current class
method
– You may invoke the method of the current class by using the this keyword. If
you don't use the this keyword, compiler automatically adds this keyword while
invoking the method. Let's see the example
80. this() : to invoke current class
constructor
– The this() constructor call can be used to invoke the current class constructor. It
is used to reuse the constructor. In other words, it is used for constructor
chaining.
81. – class A{
– A(){System.out.println("hello a");}
– A(int x){
– this();
– System.out.println(x);
– }
– }
– P s v main(String args[]){A a=new A(10); }
82. Call to this() must be the first
statement in constructor
– Student(){ //wrong example
– System.out.println(“in 0 args constructor”)
– }
– Student(int a){
– System.out.println(“in 0 args constructor”)
– this();//C.T.Error
– }
83. – Student(){ //correct example
– System.out.println(“in 0 args constructor”)
– }
– Student(int a){
– this(); //this should in first line
– System.out.println(“in 0 args constructor”)
–
– }
84. this keyword can be used to
return current class instance
– We can return this keyword as an statement from the method. In such case,
return type of the method must be the class type (non-primitive). Let's see the
example:
– return_type method_name(){
– return this;
– }
85. – public class Example2 {
– public Example2 xyz1(){
– System.out.println("from xyz1 methode "+this);
– return this;
– }
– }
86. – public class Test345 {
– public static void main(String[] args) {
– // TODO Auto-generated method stub
– Example2 example2=new Example2();
– System.out.println("------------->>>"+example2);
– example2. xyz1();
– }
87. super keyword in java
– The super keyword in java is a reference variable which is used to refer
immediate parent class object.
– Whenever you create the instance of subclass, an instance of parent class is
created implicitly which is referred by super reference variable.
88. Usage of java super Keyword
– super can be used to refer immediate parent class instance variable.
– super can be used to invoke immediate parent class method.
– super() can be used to invoke immediate parent class constructor.
89. super is used to refer immediate
parent class instance variable
– class A {
– String color="white";
– }
– class B extends A{
– String color="black";
– void printColor(){
– System.out.println(color);
– System.out.println(super.color);
– }
– }
90. super can be used to invoke parent
class method
– class A {
– void M1(){System.out.println("insuper M1..");}
– }
– class B extends A{
– void M1(){System.out.println(" in subM1..");}
– void M1(){System.out.println(" in subM2..");}
– void C(){
– super.m1();
–
– }
– }
91. – class TestSuper2{
– public static void main(String args[]){
– B b=new B();
– b.C();
– }}
92. super is used to invoke parent
class constructor
– class A {
– A(){System.out.println("in M1..");}
– }
– class B extends A{
– super();
– B() {System.out.println("in M1..");}
–
–
– }
– }
93. – class TestSuper2{
– public static void main(String args[]){
– B b=new B();
–
– }}
– super() is added in each class constructor automatically by compiler if there is
no super() or this().
94. Final Keyword In Java
– The final keyword in java is used to restrict the user. The java final keyword can
be used in many context. Final can be:
– variable
– method
– class
95. Java final variable example
– class A{
– final int a=90;//final variable
– void m1(){
– a=400;
– }
– public static void main(String args[]){
– A obj=new A();
– obj.m1();
– }
– }//end of class //compalation error
96. – If you make any variable as final, you cannot change the value of final variable(It
will be constant).
97. Java final method
– If you make any method as final, you cannot override it.
– class A{
– final public void m1()
– }
– class B extends A{
– public void m2()
– }
98. Java final class
– If you make any class as final, you cannot extend it
– final class A{
– final public void m1()
– }
– class B extends A{
– public void m2()
– } Output:Compile Time Error
99. Polymorphism
– Polymorphism is one of the OOPs feature that allows us to perform a single
action in different ways. For example, lets say we have a class Animal that has a
method sound(). Since this is a generic class so we can’t give it a
implementation like: Roar, Meow, Oink etc. We had to give a generic message
100. Method Overloading in Java
– If a class has multiple methods having same name but different in parameters,
it is known as Method Overloading.
101. – If we have to perform only one operation, having same name of the methods
increases the readability of the program.
– Suppose you have to perform addition of the given numbers but there can be
any number of arguments, if you write the method such as a(int,int) for two
parameters, and b(int,int,int) for three parameters then it may be difficult for
you as well as other programmers to understand the behavior of the method
because its name differs.
– So, we perform method overloading to figure out the program quickly.
102. Advantage of method
overloading
– Method overloading increases the readability of the program.
– Example
– void add(int a)
– void add(int a,int b)
– void add(int a,int b,int c)
103. Different ways to overload the
method
There are two ways to overload the method in java
– By changing number of arguments
– By changing the data type
– In java, Method Overloading is not possible by changing the return type of the
method only
104. Method Overloading: changing
no. of arguments
– class Add{
– static int add(int a,int b){return a+b;}
– static int add(int a,int b,int c){return a+b+c;}
– }
– class TestOverloading1{
– public static void main(String[] args){
– System.out.println(Add.add(11,11));
– System.out.println(Add.add(11,11,11));
– }}
105. Method Overloading: changing
data type of arguments
– class Add{
– static int add(int a, int b){return a+b;}
– static double add(double a, double b){return a+b;}
– }
106. Why Method Overloading is not possible by
changing the return type of method only
– In java, method overloading is not possible by changing the return type of the
method only because of ambiguity
107. – class Adder{
– static int add(int a,int b){return a+b;}
– static double add(int a,int b){return a+b;}
– }
108. Method Overriding in Java
– If subclass (child class) has the same method as declared in the parent class, it is
known as method overriding in java.
– In other words, If subclass provides the specific implementation of the method
that has been provided by one of its parent class, it is known as method
overriding.
109. Usage of Java Method
Overriding
– Method overriding is used to provide specific implementation of a method that
is already provided by its super class.
– Method overriding is used for runtime polymorphism
110. Rules for Java Method
Overriding
– method must have same name as in the parent class
– method must have same parameter as in the parent class.
– must be IS-A relationship (inheritance).
111. Example of method overriding
– class A {
– void m1(){System.out.println(“from class A m1 method");}
– }
– class B extends A{
– void m1 (){System.out.println(" from class B m1 method ");}
112. Encapsulation
– Encapsulation simply means binding object state(fields) and
behaviour(methods) together. If you are creating class, you are doing
encapsulation
113. What is encapsulation?
– The whole idea behind encapsulation is to hide the implementation details from
users. If a data member is private it means it can only be accessed within the
same class. No outside class can access private data member (variable) of other
class.
– However if we setup public getter and setter methods to update (for example
void setEmpId(int empId))and read (for example int getEmpId()) the private
data fields then the outside class can access those private data fields via public
methods.
114. Example of Encapsulation in
Java
– class EncapsulationDemo{
– private String empName;
– private int empAge;
– public String getEmpName(){
– return empName;
– }
– public String getEmpName(){
– return empName;
– }}
115. – public class EncapsTest{
– public static void main(String args[]){
– EncapsulationDemo obj = new EncapsulationDemo();
– obj.setEmpName(“xyz");
– obj.setEmpAge(10);
– System.out.println("Employee Name: " + obj.getEmpName());
– System.out.println("Employee Age: " + obj.getEmpAge());
– }
– }
116. Advantage of Encapsulation in
java
– By providing only setter or getter method, you can make the class read-only or
write-only
– It improves maintainability and flexibility and re-usability
– User would not be knowing what is going on behind the scene. They would only
be knowing that to update a field call set method and to read a field call get
method but what these set and get methods are doing is purely hidden from
them.
117. Simple example of encapsulation in
java
– package com.demo;
– public class Student{
– private String name;
–
– public String getName(){
– return name;
– }
– public void setName(String name){
– this.name=name
– }
– }
118. – //save as Test.java
– package com.demo;
– class Test{
– public static void main(String[] args){
– Student s=new Student();
– s.setName(“xyz");
– System.out.println(s.getName());
– }
– }
120. Abstraction
– Abstraction is a process of hiding the implementation details and showing only
functionality to the user.
– Another way, it shows only important things to the user and hides the internal
details for example sending sms, you just type the text and send the message.
You don't know the internal processing about the message delivery.
– Abstraction lets you focus on what the object does instead of how it does it.
121. – Ways to achieve Abstraction
– There are two ways to achieve abstraction in java
– Abstract class (0 to 100%)
– Interface (100%)
122. Interface
– Interface looks like a class but it is not a class. An interface can have methods
and variables just like the class but the methods declared in interface are by
default abstract (only method signature, no body). Also, the variables declared
in an interface are public, static & final by default
123. What is the use of interface in Java
– As mentioned above they are used for full abstraction. Since methods in
interfaces do not have body, they have to be implemented by the class before
you can access them. The class that implements interface must implement all
the methods of that interface. Also, java programming language does not allow
you to extend more than one class, However you can implement more than one
interfaces in your class
124. – Syntax:
– interface MyInterface
– {
– //All the methods are public abstract by default
–
– public void method1();
– public void method2();
– }
125. how a class implements an
interface
– It has to provide the body of all the methods that are declared in interface or in
other words you can say that class has to implement all the methods of
interface.
127. – class Demo implements MyInterface
– {
– public void method1()
– { System.out.println("implementation of method1");
– }
– public void method2()
– {System.out.println("implementation of method2");
– }
– public static void main(String arg[])
– { MyInterface obj = new Demo();
– obj.method1(); } }
128. Variables declared in interface
are public, static and final by default
– interface MyInterface
– {
– int a=10;
– public void method1();
– }
– Interface variables must be initialized at the time of declaration otherwise
compiler will throw an error.
129. Advantages of interface in java:
– Without bothering about the implementation part, we can achieve the security
of implementation
– In java, multiple inheritance is not allowed, however you can use interface to
make use of it as you can implement more than one interface.
130. Abstract Class
– A class that is declared using “abstract” keyword is known as abstract class. It
can have abstract methods(methods without body) as well as concrete methods
(regular methods with body). A normal class(non-abstract class) cannot have
abstract methods
131. Abstract class declaration
– //Declaration using abstract keyword
– abstract class A{
– //This is abstract method
– abstract void myMethod();
– //This is concrete method with body
– void anotherMethod(){
– //Does something
– }
– }
132. – As we seen in the above example, there are cases when it is difficult or often
unnecessary to implement all the methods in parent class. In these cases, we
can declare the parent class as abstract, which makes it a special class which is
not complete on its own
– Abstract class cannot be instantiated which means you cannot create the object
of it. To use this class, you need to create another class that extends this this
class and provides the implementation of abstract methods, then you can use
the object of that child class to call non-abstract methods of parent class as well
as implemented methods(those that were abstract in parent but implemented
in child class).
133. – If a child does not implement all the abstract methods of abstract parent class,
then the child class must need to be declared abstract as well
134. Why can’t we create the object of
an abstract class?
– Because these classes are incomplete, they have abstract methods that have no
body
– so if java allows you to create object of this class then if someone calls the
abstract method using that object then What would happen?There would be no
actual implementation of the method to invoke.
Also because an object is concrete. An abstract class is like a template, so you
have to extend it and build on it before you can use it
135. Abstract class Example
– abstract class AbstractDemo{
– public void myMethod(){
– System.out.println("Hello");
– }
– abstract public void anotherMethod();
– }
– public class Demo extends AbstractDemo{
– public void anotherMethod() {
– System.out.print("Abstract method");
– }
136. – public static void main(String args[])
– {
– Demo obj = new Demo();
– obj.anotherMethod();
– }