a way of viewing the world.java buzz words, java programming, constructor, method overloading and overridding,default constructors,parameterized constructors,
The document discusses the XML DOM (Document Object Model) which defines a standard for accessing and manipulating XML documents. It outlines the core DOM, XML DOM, and HTML DOM standards. The XML DOM provides an API that allows developers to navigate and modify an XML document tree. It has advantages like being language-independent and allowing traversal and modification of the XML tree, but uses more memory than SAX and is slower. The DOM organizes an XML document into a hierarchy of node types that can have child nodes.
This document provides an overview of Python programming concepts including the basics of Python, strings, control structures like if/else statements and loops, and input/output functions. It discusses what a program and programming are, gives an introduction to Python including its uses and installation. It then covers key Python concepts like variables, data types, operators, functions, modules and object-oriented programming.
NLTK: Natural Language Processing made easyoutsider2
Natural Language Toolkit(NLTK), an open source library which simplifies the implementation of Natural Language Processing(NLP) in Python is introduced. It is useful for getting started with NLP and also for research/teaching.
This document provides an overview of the Python programming language. It discusses what Python is, its key features, who uses it, common applications, and how to download and install Python. It then covers Python syntax concepts like identifiers, keywords, multiline statements, docstrings, indentation, comments, and string formatting. The document also introduces Python data types like numbers, strings, lists, tuples, dictionaries, sets and how to work with them. It describes how to convert between number types and access/update strings and lists. Finally, it discusses Python development environments like Anaconda and Spyder.
How to select the right automated testing toolKatalon Studio
One of the challenges in applying software test automation successfully in your projects is to select the appropriate automated testing tool or framework. Making the right tool choice is crucial to avoiding problems related to tools that haunt your project execution.
Let's consider some criterial when selecting automated testing tool for your project.
The document discusses different types of CSS selectors that can be used to select and style elements in an HTML document. It covers element selectors, class selectors, ID selectors, attribute selectors, and pseudo-class selectors. Examples are provided for each type of selector to demonstrate how they can be used to select elements and apply CSS styles. Combinators are also discussed, which allow selecting elements based on a specific relationship between them. In summary, the document provides an overview of CSS selector syntax and examples of how different selector types can be used to target elements in an HTML document for styling purposes.
Python is mainly used for server-side web development, development of software, maths, scripting, and artificial intelligence. It works on multiple platforms like Windows, Mac, Linux, Raspberry Pi etc.
Algorithm Design and Problem Solving [Autosaved].pptxKaavyaGaur1
This document introduces algorithms and problem solving. It discusses what a computer system is and provides examples. It also covers tools and techniques for designing algorithms like top-down design, structure diagrams, flowcharts, pseudocode, library routines, and standard problem solving methods like totaling, counting, finding max/min/average, and linear searching. Standard pseudocode constructs are also defined like variables, input/output, loops, and conditional statements.
HTML5 has updated features compared to HTML4 such as shorter document type declarations, built-in support for audio and video without plugins, vector graphics capabilities through SVG and canvas, geolocation APIs to identify user location, improved client-side storage options like application cache and web SQL, and allowing JavaScript to run in the background.
XSL stands for Extensible Stylesheet Language and is used to transform and format XML documents. The main components of XSL are:
XSLT is used to transform XML documents into other XML or HTML documents. It uses XPath to navigate XML elements and supports elements like <xsl:template>, <xsl:value-of>, <xsl:for-each> and <xsl:if>.
XSL-FO is used for formatting XML documents.
Some key XSLT elements are <xsl:template> which defines templates, <xsl:value-of> to extract node values, <xsl:for-each> for looping, <xsl:sort> and <xsl:if> for conditional
Python is a widely-used and powerful computer programming language that has helped system administrators manage computer networks and problem solve computer systems for decades. Python has also built some popular applications like BitTorrent, Blender, Calibre, Dropbox, and much more. Going further, the “Pi” in Raspberry Pi stands for Python, so learning Python will instill more confidence when working with Raspberry Pi projects. Python is usually the first programming language people learn primarily because it is easy to learn and provides a solid foundation to learn other computer programming languages. In this webinar,
• Learn what Python is and what it is capable of doing.
• Install Python’s IDE for Windows and work in the Python shell.
• Use calculations, variables, strings, lists, and if statements.
• Discover Python’s built-in functions and understand modules.
• Create simple programs to build on later.
The recording is available at https://youtu.be/ThcWmJFf-ho.
This document provides an overview of object-oriented programming (OOP) with Python. It defines some key OOP concepts like objects, classes, encapsulation, inheritance, and polymorphism. It explains that in OOP, data and functions that operate on that data are bundled together into objects. Classes provide templates for creating objects with common properties and functions. The document also gives examples of various OOP features like class variables, instance variables, methods, and constructors.
This presentation demonstrates general guidelines how to create good test cases using Robot Framework. Both good practices and anti-patterns are presented.
The presentation is hosted on GitHub where you can find the original in ODP format: https://github.com/robotframework/DosDontsSlides
This document provides an overview of chatbots including:
1. It defines chatbots as AI programs that simulate conversation through text or voice with humans.
2. It discusses the history of chatbots from early prototypes in the 1960s to modern implementations on platforms like Facebook Messenger.
3. It describes the main types of chatbots as flow-based, artificially intelligent, and hybrid models.
The document covers various topics related to CSS including CSS introduction, syntax, selectors, inclusion methods, setting backgrounds, fonts, manipulating text, and working with images. Key points include how CSS handles web page styling, the advantages of CSS, CSS versions, associating styles using embedded, inline, external and imported CSS, and properties for backgrounds, fonts, text formatting, and images.
This document provides an introduction and overview of the Python programming language. It discusses that Python was created by Guido Van Rossum in 1991 and named after Monty Python. Python can be used for both procedural and object-oriented programming approaches. It is an interpreted language that is free to use, easy to learn, and has a simple syntax. Python is popular for web development, data analysis, science/engineering, and more. The document then covers Python syntax and provides examples of using variables, data types, and the interactive mode versus script mode of writing Python code.
If you are using jQuery, you need to understand the Document Object Model and how it accounts for all the elements inside any HTML document or Web page.
The document discusses Bram Cohen's view that Python is a good language for maintainability as it has clean syntax, object encapsulation, good library support, and optional parameters, and then provides details about the history and features of the Python programming language such as being dynamically typed, having a large standard library, and being cross-platform.
These slides were prepared for the fulfillment of class presentation in Web Engineering (Masters of Science in Information System Engineering) at Gandaki College of Engineering and Science (GCES).
This document provides evaluation criteria for selecting automated test tools. It recommends evaluating criteria like object recognition abilities, platform support, recording and playback of browser and Java objects, scripting languages, debugging support, and more. The goals are to reduce the effort of evaluating tools and ensure they meet an organization's specific testing needs, environments, and skill levels. Over 80 hours may be needed to fully evaluate each tool against the outlined criteria.
The document discusses the process of writing a computer program. It explains that programming involves breaking a problem down into a logical sequence of steps. There are two main phases: the problem-solving phase where the problem is analyzed and an algorithm is developed, and the implementation phase where the algorithm is translated into a programming language and tested. The process also includes a maintenance phase to modify the program as needed over time.
The document discusses basic inheritance in Python. It explains that all classes inherit from the base Object class. Inheritance allows creating subclasses that inherit attributes and methods from a parent superclass. This allows code reuse and adding specialized behavior. An example creates a Contact class to store names and emails, with a Supplier subclass that adds an "order" method. A SupplierCheck subclass then overrides the order method to check the customer balance before processing orders.
Python is an interpreted, open source programming language that is simple, powerful, and preinstalled on many systems. It has less syntax than other languages and a plethora of penetration testing tools have already been created in Python. Python code is translated and executed by an interpreter one statement at a time, allowing it to be run from the command prompt, through command prompt files, or in an integrated development environment. The language uses whitespace and comments to make code more readable. It can perform basic operations like printing, taking user input, performing conditionals and loops, defining reusable functions, and importing additional modules.
Python is a multi-paradigm programming language created in 1989 by Guido van Rossum. It is based on ABC and Modula-3 and was named after Monty Python. Python has a simple syntax and dynamic typing and memory management. It can be used for web development, data science, scientific computing, and more. The core philosophy is summarized in the Zen of Python document. Python code is written, tested, and executed using integrated development environments like PyCharm or directly from the command line.
Productionizing Machine Learning with a Microservices ArchitectureDatabricks
Deploying machine learning models from training to production requires companies to deal with the complexity of moving workloads through different pipelines and re-writing code from scratch.
This the slide stack for the two videos on Data types in my YouTube series on JavaScript. The videos are at https://www.youtube.com/watch?v=UAtJXkGggOU and https://www.youtube.com/watch?v=H2sjsGZyYaw
Dart is an open-source programming language developed by Google that is used to build web, server, and mobile applications. It is designed to be familiar to developers from languages like JavaScript, Java, and C# but also supports strong typing. Dart aims to help developers build complex, high-fidelity client apps for the modern web. It compiles to JavaScript to run in the browser or to native code to run mobile apps. Dart supports key features like classes, mixins, asynchronous programming, and isolates for concurrency.
This document provides an introduction to object-oriented programming (OOP) concepts and the Java programming language. It discusses the key concepts of OOP like objects, classes, inheritance, polymorphism, abstraction and encapsulation. It then describes the creation of Java, its versions and types of Java programs. The document also explains Java's buzzwords like simple, object-oriented, platform independent, robust, secure, high-performance, portable and distributed. Finally, it briefly introduces the Java Runtime Environment and Java Development Kit.
This document provides an overview of core Java concepts including object-oriented programming (OOP) principles like classes, objects, encapsulation, abstraction, inheritance, and polymorphism. It also discusses Java language benefits like being simple, portable, robust, and suitable for distributed environments. Finally, it outlines how to set up a Java development environment and write a basic "Hello World" program to get started with Java programming.
HTML5 has updated features compared to HTML4 such as shorter document type declarations, built-in support for audio and video without plugins, vector graphics capabilities through SVG and canvas, geolocation APIs to identify user location, improved client-side storage options like application cache and web SQL, and allowing JavaScript to run in the background.
XSL stands for Extensible Stylesheet Language and is used to transform and format XML documents. The main components of XSL are:
XSLT is used to transform XML documents into other XML or HTML documents. It uses XPath to navigate XML elements and supports elements like <xsl:template>, <xsl:value-of>, <xsl:for-each> and <xsl:if>.
XSL-FO is used for formatting XML documents.
Some key XSLT elements are <xsl:template> which defines templates, <xsl:value-of> to extract node values, <xsl:for-each> for looping, <xsl:sort> and <xsl:if> for conditional
Python is a widely-used and powerful computer programming language that has helped system administrators manage computer networks and problem solve computer systems for decades. Python has also built some popular applications like BitTorrent, Blender, Calibre, Dropbox, and much more. Going further, the “Pi” in Raspberry Pi stands for Python, so learning Python will instill more confidence when working with Raspberry Pi projects. Python is usually the first programming language people learn primarily because it is easy to learn and provides a solid foundation to learn other computer programming languages. In this webinar,
• Learn what Python is and what it is capable of doing.
• Install Python’s IDE for Windows and work in the Python shell.
• Use calculations, variables, strings, lists, and if statements.
• Discover Python’s built-in functions and understand modules.
• Create simple programs to build on later.
The recording is available at https://youtu.be/ThcWmJFf-ho.
This document provides an overview of object-oriented programming (OOP) with Python. It defines some key OOP concepts like objects, classes, encapsulation, inheritance, and polymorphism. It explains that in OOP, data and functions that operate on that data are bundled together into objects. Classes provide templates for creating objects with common properties and functions. The document also gives examples of various OOP features like class variables, instance variables, methods, and constructors.
This presentation demonstrates general guidelines how to create good test cases using Robot Framework. Both good practices and anti-patterns are presented.
The presentation is hosted on GitHub where you can find the original in ODP format: https://github.com/robotframework/DosDontsSlides
This document provides an overview of chatbots including:
1. It defines chatbots as AI programs that simulate conversation through text or voice with humans.
2. It discusses the history of chatbots from early prototypes in the 1960s to modern implementations on platforms like Facebook Messenger.
3. It describes the main types of chatbots as flow-based, artificially intelligent, and hybrid models.
The document covers various topics related to CSS including CSS introduction, syntax, selectors, inclusion methods, setting backgrounds, fonts, manipulating text, and working with images. Key points include how CSS handles web page styling, the advantages of CSS, CSS versions, associating styles using embedded, inline, external and imported CSS, and properties for backgrounds, fonts, text formatting, and images.
This document provides an introduction and overview of the Python programming language. It discusses that Python was created by Guido Van Rossum in 1991 and named after Monty Python. Python can be used for both procedural and object-oriented programming approaches. It is an interpreted language that is free to use, easy to learn, and has a simple syntax. Python is popular for web development, data analysis, science/engineering, and more. The document then covers Python syntax and provides examples of using variables, data types, and the interactive mode versus script mode of writing Python code.
If you are using jQuery, you need to understand the Document Object Model and how it accounts for all the elements inside any HTML document or Web page.
The document discusses Bram Cohen's view that Python is a good language for maintainability as it has clean syntax, object encapsulation, good library support, and optional parameters, and then provides details about the history and features of the Python programming language such as being dynamically typed, having a large standard library, and being cross-platform.
These slides were prepared for the fulfillment of class presentation in Web Engineering (Masters of Science in Information System Engineering) at Gandaki College of Engineering and Science (GCES).
This document provides evaluation criteria for selecting automated test tools. It recommends evaluating criteria like object recognition abilities, platform support, recording and playback of browser and Java objects, scripting languages, debugging support, and more. The goals are to reduce the effort of evaluating tools and ensure they meet an organization's specific testing needs, environments, and skill levels. Over 80 hours may be needed to fully evaluate each tool against the outlined criteria.
The document discusses the process of writing a computer program. It explains that programming involves breaking a problem down into a logical sequence of steps. There are two main phases: the problem-solving phase where the problem is analyzed and an algorithm is developed, and the implementation phase where the algorithm is translated into a programming language and tested. The process also includes a maintenance phase to modify the program as needed over time.
The document discusses basic inheritance in Python. It explains that all classes inherit from the base Object class. Inheritance allows creating subclasses that inherit attributes and methods from a parent superclass. This allows code reuse and adding specialized behavior. An example creates a Contact class to store names and emails, with a Supplier subclass that adds an "order" method. A SupplierCheck subclass then overrides the order method to check the customer balance before processing orders.
Python is an interpreted, open source programming language that is simple, powerful, and preinstalled on many systems. It has less syntax than other languages and a plethora of penetration testing tools have already been created in Python. Python code is translated and executed by an interpreter one statement at a time, allowing it to be run from the command prompt, through command prompt files, or in an integrated development environment. The language uses whitespace and comments to make code more readable. It can perform basic operations like printing, taking user input, performing conditionals and loops, defining reusable functions, and importing additional modules.
Python is a multi-paradigm programming language created in 1989 by Guido van Rossum. It is based on ABC and Modula-3 and was named after Monty Python. Python has a simple syntax and dynamic typing and memory management. It can be used for web development, data science, scientific computing, and more. The core philosophy is summarized in the Zen of Python document. Python code is written, tested, and executed using integrated development environments like PyCharm or directly from the command line.
Productionizing Machine Learning with a Microservices ArchitectureDatabricks
Deploying machine learning models from training to production requires companies to deal with the complexity of moving workloads through different pipelines and re-writing code from scratch.
This the slide stack for the two videos on Data types in my YouTube series on JavaScript. The videos are at https://www.youtube.com/watch?v=UAtJXkGggOU and https://www.youtube.com/watch?v=H2sjsGZyYaw
Dart is an open-source programming language developed by Google that is used to build web, server, and mobile applications. It is designed to be familiar to developers from languages like JavaScript, Java, and C# but also supports strong typing. Dart aims to help developers build complex, high-fidelity client apps for the modern web. It compiles to JavaScript to run in the browser or to native code to run mobile apps. Dart supports key features like classes, mixins, asynchronous programming, and isolates for concurrency.
This document provides an introduction to object-oriented programming (OOP) concepts and the Java programming language. It discusses the key concepts of OOP like objects, classes, inheritance, polymorphism, abstraction and encapsulation. It then describes the creation of Java, its versions and types of Java programs. The document also explains Java's buzzwords like simple, object-oriented, platform independent, robust, secure, high-performance, portable and distributed. Finally, it briefly introduces the Java Runtime Environment and Java Development Kit.
This document provides an overview of core Java concepts including object-oriented programming (OOP) principles like classes, objects, encapsulation, abstraction, inheritance, and polymorphism. It also discusses Java language benefits like being simple, portable, robust, and suitable for distributed environments. Finally, it outlines how to set up a Java development environment and write a basic "Hello World" program to get started with Java programming.
The document provides an introduction to object-oriented programming (OOP) concepts in Java, including defining classes, objects, inheritance, polymorphism, abstraction, and encapsulation. It then discusses the key characteristics of Java like being platform independent, secure, robust, and having automatic memory management via garbage collection. The structure of a Java program and environment is also explained, covering Java source files, the Java compiler, Java Runtime Environment, Java Development Kit, and Java Virtual Machine.
Object Oriented Programming All Unit NotesBalamuruganV28
The document provides an overview of object-oriented programming (OOP) and the Java programming language. It defines key OOP concepts like objects, classes, encapsulation, inheritance, and polymorphism. It also describes features of Java like platform independence, simplicity, security, and robustness. The document then explains basic Java concepts like data types, variables, arrays, control structures, and defining classes, constructors, and methods. It provides examples of operators in Java and the difference between procedural and object-oriented programming.
This document provides a syllabus for a Java programming course including:
- 7 topics that will be covered ranging from Java fundamentals to database connectivity.
- A practical exam worth 50 marks involving 10 programming assignments.
- 12 programming assignments that will be completed as part of the term work.
- 4 references books that will be used for the course.
Introduction to oop and java fundamentalsAnsgarMary
This document provides an introduction to object-oriented programming concepts in Java, including classes, objects, inheritance, polymorphism, abstraction, and encapsulation. It then discusses the Java programming environment, fundamental programming structures in Java like data types, variables, operators, control flow statements, and arrays. Key characteristics of the Java language are also summarized.
This document provides an overview of Java technology presented during a summer training. It discusses what Java is as an object-oriented programming language that runs on any system, as well as object-oriented programming principles like encapsulation, inheritance, and polymorphism. The document also covers why Java is used, its characteristics, use in web applications, core packages, versions of the Java Development Kit, the Java life cycle, a simple Java program example, and a student's text editor project.
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 introduction to the Java programming language. It discusses the history and components of Java, including the Java language, platform, and tools. It then explains some key Java concepts like object-oriented programming, classes, objects, inheritance, and interfaces. It provides examples of how to write a simple Java program and declare methods. It also compares static and instance members and discusses abstract classes and when to use interfaces versus abstract classes.
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.
Intro to JAVA
Basics of Oops
Features of Oops
Applications of Oops
How to create a JAVA program
How to Edit a Java Program
Compiling a Java program
Java Class file
Run or Executing a Java program
Command line arguments
This document discusses key concepts in object-oriented programming (OOP) including what OOP is, the differences between procedural and object-oriented programming, advantages of OOP, what objects and classes are, and core OOP concepts in Java like abstraction, encapsulation, inheritance, and polymorphism. It provides definitions and examples to explain each concept.
This Book helps the students who are persuing B.Sc Computer Science in Andhra Pradesh. It made for learning in easiest way. Words have used in this book are very familiar. Any one can understand the language easily. Prefer this book to learn Java.
The document provides an overview of core Java concepts including classes, objects, primitive data types, arrays, object-oriented programming principles like inheritance, abstraction, encapsulation and polymorphism. It also discusses packages and libraries in Java. Key topics covered are the difference between classes and objects, how classes are used to define objects, and the standard Java packages that are included in the Java Runtime Environment.
May 2025: Top 10 Read Articles Advanced Information Technologyijait
International journal of advanced Information technology (IJAIT) is a bi monthly open access peer-reviewed journal, will act as a major forum for the presentation of innovative ideas, approaches, developments, and research projects in the area advanced information technology applications and services. It will also serve to facilitate the exchange of information between researchers and industry professionals to discuss the latest issues and advancement in the area of advanced IT. Core areas of advanced IT and multi-disciplinary and its applications will be covered during the conferences.
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODSsamueljackson3773
In this paper, the author discusses the concerns of using various wireless communications and how to use
them safely. The author also discusses the future of the wireless industry, wireless communication
security, protection methods, and techniques that could help organizations establish a secure wireless
connection with their employees. The author also discusses other essential factors to learn and note when
manufacturing, selling, or using wireless networks and wireless communication systems.
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...ijfcstjournal
One of the major challenges for software, nowadays, is software cost estimation. It refers to estimating the
cost of all activities including software development, design, supervision, maintenance and so on. Accurate
cost-estimation of software projects optimizes the internal and external processes, staff works, efforts and
the overheads to be coordinated with one another. In the management software projects, estimation must
be taken into account so that reduces costs, timing and possible risks to avoid project failure. In this paper,
a decision- support system using a combination of multi-layer artificial neural network and decision tree is
proposed to estimate the cost of software projects. In the model included into the proposed system,
normalizing factors, which is vital in evaluating efforts and costs estimation, is carried out using C4.5
decision tree. Moreover, testing and training factors are done by multi-layer artificial neural network and
the most optimal values are allocated to them. The experimental results and evaluations on Dataset
NASA60 show that the proposed system has less amount of the total average relative error compared with
COCOMO model.
David Boutry - Mentors Junior DevelopersDavid Boutry
David Boutry is a Senior Software Engineer in New York with expertise in high-performance data processing and cloud technologies like AWS and Kubernetes. With over eight years in the field, he has led projects that improved system scalability and reduced processing times by 40%. He actively mentors aspiring developers and holds certifications in AWS, Scrum, and Azure.
How Binning Affects LED Performance & Consistency.pdfMina Anis
🔍 What’s Inside:
📦 What Is LED Binning?
• The process of sorting LEDs by color temperature, brightness, voltage, and CRI
• Ensures visual and performance consistency across large installations
🎨 Why It Matters:
• Inconsistent binning leads to uneven color and brightness
• Impacts brand perception, customer satisfaction, and warranty claims
📊 Key Concepts Explained:
• SDCM (Standard Deviation of Color Matching)
• Recommended bin tolerances by application (e.g., 1–3 SDCM for retail/museums)
• How to read bin codes from LED datasheets
• The difference between ANSI/NEMA standards and proprietary bin maps
🧠 Advanced Practices:
• AI-assisted bin prediction
• Color blending and dynamic calibration
• Customized binning for high-end or global projects
11th International Conference on Data Mining (DaMi 2025)kjim477n
Welcome To DAMI 2025
Submit Your Research Articles...!!!
11th International Conference on Data Mining (DaMi 2025)
July 26 ~ 27, 2025, London, United Kingdom
Submission Deadline : June 07, 2025
Paper Submission : https://csit2025.org/submission/index.php
Contact Us : Here's where you can reach us : [email protected] or [email protected]
For more details visit : Webpage : https://csit2025.org/dami/index
Top Cite Articles- International Journal on Soft Computing, Artificial Intell...ijscai
International Journal on Soft Computing, Artificial Intelligence and Applications (IJSCAI) is an open access peer-reviewed journal that provides an excellent international forum for sharing knowledge and results in theory, methodology and applications of Artificial Intelligence, Soft Computing. The Journal looks for significant contributions to all major fields of the Artificial Intelligence, Soft Computing in theoretical and practical aspects. The aim of the Journal is to provide a platform to the researchers and practitioners from both academia as well as industry to meet and share cutting-edge development in the field.
This study will provide the audience with an understanding of the capabilities of soft tools such as Artificial Neural Networks (ANN), Support Vector Regression (SVR), Model Trees (MT), and Multi-Gene Genetic Programming (MGGP) as a statistical downscaling tool. Many projects are underway around the world to downscale the data from Global Climate Models (GCM). The majority of the statistical tools have a lengthy downscaling pipeline to follow. To improve its accuracy, the GCM data is re-gridded according to the grid points of the observed data, standardized, and, sometimes, bias-removal is required. The current work suggests that future precipitation can be predicted by using precipitation data from the nearest four grid points as input to soft tools and observed precipitation as output. This research aims to estimate precipitation trends in the near future (2021-2050), using 5 GCMs, for Pune, in the state of Maharashtra, India. The findings indicate that each one of the soft tools can model the precipitation with excellent accuracy as compared to the traditional method of Distribution Based Scaling (DBS). The results show that ANN models appear to give the best results, followed by MT, then MGGP, and finally SVR. This work is one of a kind in that it provides insights into the changing monsoon season in Pune. The anticipated average precipitation levels depict a rise of 300–500% in January, along with increases of 200-300% in February and March, and a 100-150% increase for April and December. In contrast, rainfall appears to be decreasing by 20-30% between June and September.
本資料「To CoT or not to CoT?」では、大規模言語モデルにおけるChain of Thought(CoT)プロンプトの効果について詳しく解説しています。
CoTはあらゆるタスクに効く万能な手法ではなく、特に数学的・論理的・アルゴリズム的な推論を伴う課題で高い効果を発揮することが実験から示されています。
一方で、常識や一般知識を問う問題に対しては効果が限定的であることも明らかになりました。
複雑な問題を段階的に分解・実行する「計画と実行」のプロセスにおいて、CoTの強みが活かされる点も注目ポイントです。
This presentation explores when Chain of Thought (CoT) prompting is truly effective in large language models.
The findings show that CoT significantly improves performance on tasks involving mathematical or logical reasoning, while its impact is limited on general knowledge or commonsense tasks.
Flow Chart Proses Bisnis prosscesss.docxrifka575530
Ad
object oriented programming through java basics
1. Unit-1
object oriented thinking and java
basics
Need for oop paradigm, summary of oop concepts, coping
with complexity, abstraction mechanisms. A way of
viewing world – Agents, responsibility, messages,
methods, History of Java, Java buzzwords, data types,
variables, scope and lifetime of variables, arrays,
operators, expressions, control statements, type
conversion and casting, simple java program, concepts of
classes, objects, constructors, methods, access control,
this keyword, garbage collection, overloading methods and
constructors, method binding, inheritance, overriding and
exceptions, parameter passing, recursion, nested and
inner classes, exploring string class.
12. A way of viewing the world is an idea to
illustrate the object-oriented programming
concept with an example of a real-world
situation.
Let us consider a situation, I am at my
office and I wish to get food to my family
members who are at my home from a hotel.
Because of the distance from my office to
home, there is no possibility of getting food
from a hotel myself. So, how do we solve
the issue?
To solve the problem, let me call Zomato
(an agent in food delivery community), tell
them the variety and quantity of food and
the hotel name from which I wish to
deliver the food to my family members.
Look at the following image.
A Way of Viewing the world
Agents and Communities
To solve my food delivery problem, I used a
solution by finding an appropriate agent
(Zomato) and pass a message containing my
request. It is the responsibility of the agent
(Zomato) to satisfy my request. Here, the
agent uses some method to do this. I do not
need to know the method that the agent has
used to solve my request. This is usually
hidden from me.
So, in object-oriented programming,
problem-solving is the solution to our
problem which requires the help of many
individuals in the community. We may
describe agents and communities as follows.
13. Messages and Methods
To solve my problem, I started with a
request to the agent Zomato, which led
to still more requests among the
members of the community until my
request has done. Here, the members of
a community interact with one another
by making requests until the problem
has satisfied.
Responsibilities
In object-oriented programming, behaviors of
an object described in terms of responsibilities.
In our example, my request for action indicates
only the desired outcome (food delivered to my
family). The agent (Zomato) free to use any
technique that solves my problem. By
discussing a problem in terms of
responsibilities increases the level of
abstraction. This enables more independence
between the objects in solving complex
problems.
15. Introduction to Java
⚫Java is a purely an object – oriented language.
⚫In 1991, James Gosling and Patrick Naughton
developed named “OAK” at Sun Microsystems.
⚫Java is simple and platform-independent.
⚫In 1995, this language was renamed as “Java”.
⚫Java history is interesting to know. The history of
java starts from Green
16. Introduction to Java
⚫ Java team members (also known as Green Team), initiated a
revolutionary task to develop a language for digital devices
such as set-top boxes, televisions etc.
⚫ For the green team members, it was an advance concept at
that time. But, it was suited for internet programming.
⚫ Later,Java technology as incorporated by Netscape.
⚫ Currently, Java is used in internet programming
17. Introduction to Java – History –
Why Oak name?
⚫After that, it was called Oak and was developed as
a part of the Green project.
⚫Why Oak? Oak is a symbol of strength and
choosen as a national tree of many countries like
U.S.A.,France, Germany, Romania etc.
⚫In 1995, Oak was renamed as
"Java" because it was already a
trademark by Oak Technologies.
18. Introduction to Java – Versions
⚫Sun Microsystems has been releasing new
versions of JDK. The originally version of Java
released in 1995, was called JDK1.0 version.
⚫The versions are JDK1.1, JDK1.2, JDK1.3, JDK1.4
and JDK1.5, JDK1.6, JDK1.7 and JDK1.8.
20. Introduction to Java – JDK Tools
Tool in
JDK
Purpose
appletviewe
r
This tool helps us to execute a special type
of Java program known as applets.
java This tool is the Java interpreter. It
interprets the bytecode into machine code
and then executes it
javac This tool is Java compiler. It compiles the
Java source code into the bytecode, which can
be understood by JVM.
javadoc This tool is used to create documentation
in HTML.
javah This tool produces C header files for use with
a special type of Java methods, known as
native methods.
23. Introduction to Java – Types of
applications
⚫Three types of programs, can be developed using
Java, Namely applets, servlets and stand-alone
applications.
⚫Applet is a Java program that is developed exclusively
for the Internet.
⚫Applets are embedded in HTML documents that take
care of the design of web pages.
⚫Servlets are used to create dynamic web content.
⚫Stand-alone applications can be executed without the
internet connectivity.
29. OOPS and Java
⚫Java is a purely an object – oriented language.
⚫The central idea behind object-oriented
programming is to divide a program into isolated
parts called Objects.
⚫Each object contain two parts.
⚫Data
⚫Functions
⚫The functions in an object operate on the data
involved in that object.
30. OOPS and Java – Objects and
Classes
⚫ Data and routines (functions) required to process it are
combined into a single entity called an Object.
⚫ A collection of similar objects is known as a class.
(Blueprint of Object).
⚫ In order to clearly understand the idea of objects, lets us
now consider an example. Suppose we are planning a
birthday party and we wish to play some songs available in
our compact disk. there is an index card file, in which each
card contains a song’s name, its author and its playing time
in the following format.
⚫Song
⚫name
31. OOPS and Java - Objects and
Classes
⚫The above mentioned data in the index card file can
be used to get the following types of information about
a particular song of interest.
⚫Name of the song
⚫Name of the Author,
⚫Playing time of the song.
⚫ Name the routines (funtions) to get the above mentioned
three types of information from the index card file as
getName(), getAuthor(), and getPlayingTime() and the
routine for instructing the computer to play a song as
playSong().
32. OOPS and Java - Objects and
Classes
⚫ It should be carefully note here that all the above mentioned four
routines are concerned with the three data items.
⚫ . The data is combined to form the objects
34. OOPS and Java –
object and classes
⚫Once we define a class, we can declare a group of
objects for that class.
⚫ Each object in such a group contains the data and
member functions that have been defined in that
class.
⚫In other words, each object in such a group of
objects imitates the exact characteristics of the
class, which serves as a plan or template.
35. OOPS and Java - Encapsulation
⚫One of the most powerful and important points of OOP
is that access to a class is strictly regulated.
⚫If we wish to modify or access the data in an object, we
have to issue a command to that object, which will use
its member function to retrieve the requested data and
communicate them.
⚫The above mentioned mode of retrieval means that the
data are wantonly hidden, so that they are not directly
accessible to the user. Here, the data and its related
37. OOPS and Java - Inheritance
⚫Inheritance is one the most powerful capabilities of
object-oriented programming.
⚫Using this concept, a new class of objects can be
derived from an old one. This process is called
inheritance because the new class inherits the
characteristics of the original class.
⚫The new class is called a derived class of the
original class and the original class is called the
base class of the new class.
38. OOPS and Java - Inheritance
⚫The derived class can called as sub class or child
class.
⚫The base class can called as super class or parent
class.
⚫There are five types of Inheritance
⚫Singe Inheritance – One base class, one derived class.
⚫Multilevel Inheritance – The derived class can act as
base class.
⚫Multiple Inheritance – More than one base class.
41. OOPS and Java – Polymorphism
⚫We can build up subclasses from a base class by
using the concept of inheritance.
⚫We can specify a unique behavior to each
subclass by using the concept of polymorphism.
⚫Thus, we can design the derived classes in such a
way that they respond to a message that a base
class responds to, but at the same time they can
perform different functions by making use of
concepts of polymorphism.
42. OOPS and Java – Polymorphism
⚫If we redefine the functionality of a base class
member function in a subclass, we say that we
override its base class functionality.
⚫Overloading an important feature of OOP is that
process of attaching different functionalities to a
function or a operator depending on the different
contexts.
⚫Two types.
⚫Runtime Polymorphism – Virtual Functions
52. A Simple Java Program ( Creating &
Executing )
⚫File name is Hello.java
class Hello
{
public static void main(String[] args)
{
System.out.println(“Hello, Welcome to
Java Application”);
}
}
⚫Type the above program in notepad editor.
as Hello.java in bin directory of java
⚫Save it
software.
⚫Compile the program using command javac
Hello.java
53. A Simple Java Program ( Creating &
Executing )
⚫ In java, a source program is first compiled and
interpreted. After the compilation is over, the compiled
version of the source file is stored in special format, namely
the bytecode format.
⚫ The source file is stored under the name
Hello.java
⚫The compiled code is stored under the
Hello.class During the interpretation
name stage,
Hello.class file is converted into the machine code
54. A Simple Java Program ( Creating &
Executing )
⚫Hello.class file contains the byte code
corresponding to the code that we have written in
Hello.java.
⚫The Java interpreter, name java, loads the
bytecode in Hello.class file, starts the execution of
our program, and loads the necessary library files.
Syntax: java class name Example: java Hello
⚫Ouput will be
Hello, Welcome to Java Applicaiton
56. time?
⚫At compile time, java file is compiled by Java Compiler
(It does not interact with OS) and converts the java
code into bytecode.
57. time?
⚫ Classloader:
subsystem of
is the
JVM
that is used to load
class files.
Verifier:
⚫ Bytecode
checks the
fragments for
code
illegal
code that can violate
access right to
objects.
⚫ Interpreter: read
bytecode stream then
58. by other name than the class
name?
⚫Yes, if the class is not public. It is explained in the
figure given below:
⚫To compile: javac Hard.java
⚫To execute: java Simple
60. A Simple Java Program (Understanding)
⚫File name is Hello.java
class Hello
{
public static void main(String[] args)
{
System.out.println(“Hello, Welcome to
Java Application”);
}
}
⚫As Java is a pure OOP-based language, each
simple Java program is written in the form of a
class.
⚫In java, a class consists of certain data members
and the related methods.
61. A Simple Java Program (Understanding)
⚫ Since the Hello.java program is a very simple one
involving any input or output variables, it doesn’t contain
any data members.
⚫ It contains only one method, namely the main(), which
must be present in every Java stand-alone application.
Since this method is not expected to return any
value, the return type of this method is indicated in
the above program as void.
⚫ In java, we usually create an object of a class .
62. A Simple Java Program (Understanding)
⚫However, in certain cases, we prefer to access the
methods in a class without creating an object for
that class. Such methods are known as static
methods.
⚫It shall be noted here that main() is a static
method.
⚫As is apparent from the above program, the
elements of an array of String type, called args,
constitute the parameters of the main() method.
63. A Simple Java Program (Understanding)
⚫ But it is not necessary to always provide the values for
these parameters.
⚫ The first period in System.out.println means
“locate the out object in the System class”.
⚫ The Second period means “apply the println()
method to that object”.
⚫ The System class, the out object and the println() method
have all been predefined by the Java developers.
65. Character Set
⚫ The set of characters allowed in Java constitutes its
character set. All the constituents of a java program, such as
the constants, variables, expressions and statements are
written only by using characters in the following character
set:
Numerals : 0-9
Alphapets : a-z (Lower Case), A-Z (Upper Case)
Special characters: + - * / % = < > ( ) . ; , ‘ ’ : ? # $ ! ^
& ~ [ ] { }
⚫ Java uses the uniform 16-bit coding scheme called Unicode to
represent characters internally. The Unicode can
66. Tokens - Keywords
⚫The smallest individual entities in a Java program
are known as tokens.
⚫Five important types of tokens are listed below:
⚫Reserved keywords, identifiers, literals, operators,
separators.
⚫Around 60 words have been reserved as the keywords
in Java. They have predefined specific meanings. They
should be written in lower-case letters. Here are some
valid keywords.
⚫break, continue, switch, private, while
67. Tokens – Rules for defining identifiers
⚫ The names that the programmer assign for the classes,
methods, variables, objects, packages and interfaces in a java
program are known as identifiers. They should follow the
following rules.
They shall contain digits, alphabets, underscore and dollar
sign characters.
No white spaces are allowed.
A keywords should not be used as a identifier.
The first character should not be a digit.
They shall have any number of characters.
68. Tokens – Valid & Invalid Identifiers
⚫Some valid identifiers are furnished below
rectangle, perimeter$, count, r2, shape2d,
tv_Channel
⚫Some invalid identifiers are furnished below
rect angle, 2day, tv&Channel, good morning,
wel@com
69. Tokens – Literals
⚫A sequence of valid characters that represents a
constant value is called a literal. Literals are also
know as constants.
⚫Five major types of literals available in Java are as
follows
Integer
Floating point
Character
String
70. Tokens – Operator and Separator
⚫A symbol that represents an operation, such as
multiplication or division, is called an operator.
⚫Some of the well-known operators are available in
Java are as follows.
⚫+ - * / % < > && || ! ++ -- += -= *= /=
⚫A symbol that is used to separate one group of
code from another group is called a separator.
of the well-known separators are listed
Some
below
{} ( ) [] ; , ‘ ’ “ ”
72. Variables
⚫Variable is name of reserved area allocated in
memory. In other words, it is a name of memory
location.
⚫It is a combination of "vary + able" that means its
value can be changed.
73. Variables - Rules
⚫The first character in a variable name should not
be digit.
⚫A variable name may consist of alphabets, digits,
the underscore character and the dollar character.
⚫A keyword should not be use as a variable name.
⚫White spaces are not allowed within a variable
name.
⚫A variable name can be of any length
74. Variables
⚫Every variable has a data type.
⚫Every variable has a value.
⚫Every variable is the name of a storage location.
⚫Every variable has its size.
75. Variables - Declaration
⚫Variable can declared as follows
data-type variable-
access-specifier
name
⚫Here,
⚫access-specifier specifies which methods can
access the variable. Most variables are declared
as private.
⚫data-type refers to the type of the variable. Here
is a valid type declaration statement.
77. Variables – Types of Variables
1) Local Variable
A variable which is declared inside the
method is called local variable.
2) Instance Variable
A variable which is declared inside the
class but outside the method, is called
instance variable . It is not declared as static.
3) Static variable
A variable that is declared as static is
called static variable. It cannot be local.
78. Variables – Examples to understand types of
Variables
class A
{
int data=50;//instance variable
static int m=100;//static variable
void method()
{
int n=90;//local variable
} //end of method.
}//end of class
79. Constants
⚫Constants means it can not be changed, that
as follows:
means fixed value. Declaration
const const-name=value;
⚫Types are
⚫Integer constant
⚫Floating point constant
⚫Character constant
⚫Boolean constant
⚫Backslash character constant or Escape
Sequence Character
80. Constants – Backslash Character
Constants
Backslash
character
constant
Meaning
b Backspace
n New line
t Tab
r Carriage return
f Form feed
Backslash
’ Single quote
” Double quote
85. Operators and Expressions
⚫Operator in java is a symbol that is used to perform
operations.
⚫There are many types of operators in java such as
unary operator, arithmetic operator, relational operator,
shift operator, bitwise operator, ternary operator and
assignment operator.
⚫These operators are classified into three
⚫Unary Operator – works with one operand
⚫Binary Operator – works with two operands.
86. Operators and Expressions
⚫Combination of operators and operands are called
expressions.
⚫When we assign an expression to a variable, the
types of the variable and the expression should be
compatible.
double sum = 10.1;
int total = sum;
We must convert the floating point expression to
integer by using a cast, as shown below
88. Library Methods
⚫Library methods are normally used to write the
expressions in a compact manner. For example,
the expression
𝑥 = −𝑏± 𝑏2−4𝑎𝑐
2𝑎
can be compactly represented as shown below, by
using the sqrt() library methods:
( -b + Math.sqrt(b*b-4*a*c))/(2*a)
89. Library Methods
Library
Method
Purpose
Math.sqrt(x) To find square root of x (>=0)
Math.pow(x,y) To find 𝑋𝑦 (x >0 and x =0 and y>0 or x<0
and y is an integer)
Math.sin(x) To find Sine of x (x in radians)
Math.cos(x) To find Cosine of x
Math.tan(x) To find Tangent of x
Math.asin(x) To find Arc sine of x
Math.acos(x) To find Arc cosine of x
Math.atan(x) To find Arc tangent of x
Math.toRadians(
x)
To convert x radians to degrees
90. Library Methods
Library
Method
Purpose
Math.toDegrees
(x)
To convert x degrees to radians
Math.exp(x) To find 𝑒𝑥
Math.log(x) To find natural log
Math.round(x) To find closest integer to x
Math.ceil(x) To find smallest integer >=x
Math.floor(x) To find largest integer <=x
Math.abs(x) To find the absolute value |x|
92. Strings
⚫string is the most important data type used in
programs.
⚫A string is a sequence of characters. In, Java a
string is enclosed in quotation marks, as in the
case of the example “Don Bosco College”.
⚫The String keyword, which represents the string
data type, starts with an uppercase letter. This is
because of the fact that the keyword String is the
name of a predefined class.
93. Strings – length() Method
⚫The number of characters in a string is provided by
the length() method of the String class, as
illustrated below
String collegeName = “Don Bosco College”;
int wordLength = collegeName.length();
⚫Since the string “Don Bosco College” consists
method will
of 17 characters, the length()
return the value 17.
⚫A string contains no characters is called an
94. Strings – Concatenation Operator (+)
⚫Two strings shall be concatenated by using the +
operator. This operator is a powerful operator. If
one of the two operands, either to the left or the
right of the + operator is a string, then the other
operand is automatically converted into a string
and both strings are concatenated. Here is an
example.
String s = “Price:”;
int price = 83;
95. Strings
⚫Here, the expression s + price has strings operand
and an integer operand. They will be concatenated
into the single string “Price : 83” and assigned to
the variable result.
97. Input and Output Statements
⚫Every program needs some data as input.
Similarly, every program provides some processed
data as output.
⚫While the input operations enable us to provide
input data to a program, the output operations help
us to get the output displayed in a desired format.
⚫Java provides a rich set of I/O functions for
performing a variety of operations.
98. I/O statement – Console Output
⚫ The out object in the System class represents the
standard output stream.
⚫ The out object has two methods for sending the output
to the Console screen. They are print() and the
println() methods.
⚫ While the print() method displays the output without a
newline character, the println() method displays the
output with a newline character.
⚫ Since both the print() and the println() methods are
heavily overloaded methods, they can output many
different types of data, such as int, double, char,
99. I/O statement – Console Output
System.out.print(“Welcome to Java.”);
System.out.println(“Have a nice time.”);
⚫ Here, the System.out.print() method displays the
message Welcome to Java on the screen and
retains the cursor on the same line.
⚫ The System.out.println() method displays the string
Have a nice time and moves the cursor to the
beginning of the next line. Here is a sample
output:
Welcome to Java.Have a nice time.
100. I/O statement – Console Output
⚫ Sometimes, we may wish to have a blank line
between two sets of output values. We shall print
a blank line by using println() method, as shown
below:
System.out.println(“Value of A = 1000”);
System.out.println();
System.out.println(“Value of B = 2000”);
⚫The above snippet will render the output in the
following form:
Value of A = 1000
101. I/O statement – Console Input
⚫In java, any input is read in as a string.
System.out.print(“Enter Your Name :”);
InputStreamReader reader = new
InputStreamReader(System.in);
BufferedReader in = new BufferedReader( reader);
String name = in.readLine();
⚫In the above program, the name that is keyed in by
the user is received by the system and stored in
the buffer System.in terms of bytes.
102. I/O statement – Console Input
⚫When the second statement in the above snippet
is executed, the bytes in the buffer System.in are
converted into characters and stored in the object
reader.
InputStreamReader
⚫An object, such as reader,
can read characters, but it cannot read a while
string at time.
⚫In order to overcome this limitation, we turn the
input stream reader into a BufferedReader object,
103. I/O statement – Console Input
⚫ When the fourth statement in the following snippet is
executed, the readLine() method reads in a string
(i.e. a name) and stores it in the String type variable
name.
⚫ Suppose that we provide 1000 as the input to the
following snippet.
⚫ This value will be initially read in as the string “1000”
and stored as the value of a string type variable text.
⚫ The parseInt() method, is used.
104. I/O statement – Console Input
System.out.print(“Enter the amount in dollars:”);
InputStreamReader reader = new
InputStreamReader( System.in );
BufferedReader in = new BufferedReader( reader );
String text = in.readLine();
int dollar = Integer.parseInt( text );
⚫ Here, parseInt() method is used to convert string
into int.
105. I/O - Console Input using Scanner
Class
⚫ There are various ways to read input from the
keyboard, the java.util.Scanner class is one of them.
⚫ The Java Scanner class breaks the input into tokens
using a delimiter that is whitespace by default.
⚫ It provides many methods to read and parse various
primitive values.
106. Methods
Method Description
public String next()
it returns the next token from the scanner.
public String nextLine()
it moves the scanner position to the next line and
returns the value as a string.
public byte nextByte() it scans the next token as a byte.
public short nextShort()
it scans the next token as a short value.
public int nextInt()
it scans the next token as an int value.
public long nextLong()
it scans the next token as a long value.
107. I/O - Scanner Class Example
import java.util.Scanner;
class ScannerTest
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter your rollno");
int rollno=sc.nextInt();
System.out.println("Enter your name");
String name=sc.next();
108. I/O - Scanner Class Example
System.out.println("Enter your fee");
double fee=sc.nextDouble();
System.out.println("Rollno:"+rollno+"name:
"+name+" fee:"+fee);
sc.close();
}
}
Output:
Enter your rollno
111
Enter your name
Vijay
Enter
450000
Rollno:111 name:Vijay fee:450000
110. Control Statements
⚫The control statements are used to control over the
order of execution of the statements.
⚫The two major types of control statements
available in Java are the decision-making
statements and the repetitive statements.
⚫Decision-making Statements – if, if-else,
switch
⚫Repetitive statements – for, while, do-
112. Control Statements
⚫The Java if statement is used to test the condition.
It checks boolean condition: true or false.
⚫There are various types of if statement in java.
⚫if statement
⚫if-else statement
⚫nested if statement
⚫if-else-if ladder
⚫Switch statement
113. Control Statements – if statement
⚫The Java if statement tests the condition. It
executes the if block if condition is true.
⚫The syntax as follows
if(condition)
{
//code to be executed
}
114. Control Statements – if statement -
example
public class IfExample
{
public static void main(String[] args)
{
int age=20;
if(age>18)
{
System.out.print("Age is
greater than 18");
}
}
}
Output:
Age is greater than 18
115. Control Statements – if-else
statement
⚫The Java if-else statement also tests the condition.
⚫It executes the if block if condition is true otherwise
else block is executed.
⚫Syntax as follow:
if(condition)
{
//code if condition is true
}
else
{
//code if condition is false
}
116. Control Statements – if-else -
Example
public class IfElseExample
{
public static void main(String[] args)
{
int number=13;
if(number%2==0)
{
System.out.println("even
number");
}
else
{
System.out.println("odd number");
}
}
}
Output:
odd number
117. Control Statements – if-else-if ladder
⚫ The if-else-if ladder statement executes one condition from
multiple statements. The syntax as follows:
if(condition1){
//code to be executed if condition1 is true
}else if(condition2){
//code to be executed if condition2 is true
}
else if(condition3){
//code to be executed if condition3 is true
}
...
else{
//code to be executed if all the conditions are
false
}
118. Control Statements – if-else-if
Example
public class IfElseIfExample
{
public static void main(String[] args)
{
int marks=65;
if(marks<50)
{
System.out.println("fail");
}
else if(marks>=50 && marks<60)
{
System.out.println("D grade");
}
120. Control Statements – if-else-if
Example
else if(marks>=90 && marks<100)
{
System.out.println("A+ grade");
}
else
{
System.out.println("Invalid!");
}
}
}
Output:
C grade
121. Control Statements – switch
statement
⚫The Java switch statement executes one
statement from multiple conditions. It is like if-else-
if ladder statement. The syntax as follows:
switch(expression)
{
case value1:
//code to be executed;
break; //optional
case value2:
//code to be executed;
break; //optional
......
default:
code to be executed if all
cases are not matched;
}
122. Control Statements – switch
–
Example
public class SwitchExample
{
public static void main(String[] args)
{
int number=20;
switch(number)
{
case 10: System.out.println(“Ten"); break;
case 20: System.out.println(“Twenty"); break;
case 30: System.out.println(“Thirty"); break;
default: System.out.println("Not in 10, 20 or
30");
}
}
}
Output
Twenty
124. Looping Statements
⚫The Java for loop is used to iterate a part of the
program several times. If the number of iteration is
fixed, it is recommended to use for loop.
⚫There are three types of for loop in java.
⚫Simple For Loop
⚫For-each or Enhanced For Loop
⚫Labeled For Loop
125. Looping Statements – for loop
⚫The simple for loop is same as C/C++. We can
initialize variable, check condition and
increment/decrement value. The syntax as follows:
for(initialization; condition; incr/decr)
{
//code to be executed
}
126. Looping Statements – for loop -
Example
public class ForExample
{
public static void main(String[] args)
{
for(int i=1;i<=10;i++)
{
System.out.println(i);
}
}
}
Output:
1
2
3
4
5
6
7
8
9
10
127. Looping Statements – for each
⚫The for-each loop is used to traverse array or
collection in java. It is easier to use than simple for
loop because we don't need to increment value and
use subscript notation.
⚫It works on elements basis not index. It returns
element one by one in the defined variable. The
syntax as follows
for(Type var:array)
{
//code to be executed
128. Looping Statements – for each -
Example
public class ForEachExample
{
public static void main(String[] args)
{
int arr[]={12,23,44,56,78};
for(int i:arr)
{
}
}
Output:
System.out.println(i);
12
23
44
56
129. Looping Statements – While loop–Entry
controlled
⚫The Java while loop is used to iterate a part of the
program several times. If the number of iteration is
not fixed, it is recommended to use while loop.
Syntax:
while(condition)
{
//code to be executed
}
131. Looping Statements–do-while loop–Exit
controlled
⚫The Java do-while loop is used to iterate a part of the
program several times.
⚫If the number of iteration is not fixed and you must have
to execute the loop at least once, it is recommended to
use do-while loop.
⚫The Java do-while loop is executed at least once
is checked after loop body. The
because condition
syntax as follows:
do
{
134. Jumping Statements – break statement
⚫The Java break is used to break loop or switch
statement. It breaks the current flow of the program
at specified condition. In case of inner loop, it
breaks only inner loop.
Syntax:
jump-statement;
break;
135. Jumping Statements – break statement-
example
public class BreakExample
{
public static void main(String[] args)
{
for(int i=1;i<=10;i++)
{
if(i==5)
{
break;
}
System.out.println(i);
}
}
}
Output:
1
2
3
4
136. statement
⚫The Java continue statement is used to continue
loop. It continues the current flow of the program
and skips the remaining code at specified condition.
In case of inner loop, it continues only inner loop.
Syntax:
jump-statement;
continue;
139. Arrays
⚫Normally, Array is a collection of similar type of
elements that have contiguous memory location.
⚫Java array is an object the contains elements of
similar data type.
⚫It is a data structure where we store similar
elements.
⚫We can store only fixed set of elements in a java
array.
140. Arrays
⚫Array in java is index based, first element of the
array is stored at 0 index.
141. Arrays – Advantage & Disadvantages
⚫Advantages:
⚫Code Optimization: It makes the code
optimized, we can retrieve or sort the data easily.
⚫Random access: We can get any data located
at any index position.
⚫Disadvantages:
⚫Size Limit: We can store only fixed size of
elements in the array. It doesn't grow its size at
runtime. To solve this problem, collection
143. One dimensional arrays – Syntax to
declare dataType[] arr; (or)
dataType []arr; (or)
dataType arr[];
⚫Instantiation of an Array in java
arrayRefVar=new datatype[size];
Ex. int marks=new int[5];
144. One dimensional arrays – Example
class Testarray {
public static void main(String args[]){
int a[]=new int[5];//declaration and instantiation
a[0]=10;//initialization
a[1]=20;
a[2]=70;
a[3]=40;
a[4]=50;
//printing array
for(int i=0;i<a.length;i++)//length is the property of array
System.out.println(a[i]);
}}
Output: 10
20
70
40
50
145. Declaration, Instantiation, and Initialization
⚫ We can declare, instantiate and initialize the
java array together by:
int a[]={33,3,4,5};//declaration,
instantiation and initialization
146. Passing array to method in Java
⚫ We can pass the java array to method so that we can
reuse the same logic on any array.
class Testarray2{
static void min(int arr[]){
int min=arr[0];
for(int i=1;i<arr.length;i++)
if(min>arr[i])
min=arr[i];
System.out.println(min);
}
public static void main(String args[]){
int a[]={33,3,4,5};
min(a);//passing array to method } }
Output:3
148. Two Dimensional Arrays
⚫In such case, data is stored in row and column
based index (also known as matrix form).
⚫Syntax to Declare Multidimensional Array in
java
dataType[][] arrayRefVar; (or)
dataType [][]arrayRefVar; (or)
dataType arrayRefVar[][]; (or)
dataType []arrayRefVar[];
⚫Example to instantiate Multidimensional Array in
java
149. Example to initialize two dimensional Array in java
arr[0][0]=1;
arr[0][1]=2;
arr[0][2]=3;
arr[1][0]=4;
arr[1][1]=5;
arr[1][2]=6;
arr[2][0]=7;
arr[2][1]=8;
arr[2][2]=9;
150. Two Dimensional Array - Example
class Testarray3{
public static void main(String args[]){
//declaring and initializing 2D array
int arr[][]={{1,2,3},{2,4,5},{4,4,5}};
//printing 2D array
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
System.out.print(arr[i][j]+" ");
}
System.out.println();
}
}}
Output:1 2 3
2 4 5
4 4 5
152. Methods
⚫A method is a self-contained entity that carries out
a well-defined task of some kind.
⚫For example, a method named rectangleArea()
may be defined so as to compute the area of
rectangle. The methods in class are its basic
operation entities.
⚫Methods are also called functions, member
functions (in class), routine or procedures.
⚫In java we are calling Methods.
153. Methods – General Form
⚫Each method carried out well-defined task.
⚫Each method has a name and a list of parameters.
⚫Any valid identifier can be assigned as the name of a
method. However, this names of predefined methods
and keywords are not to be used as the names of
user-defined methods.
⚫The syntax of a method is as follows
access-specifier return-type method-name (parameter
list)
{
statement 1;
…
statement n;
154. Methods – General Form
⚫Here,
1. access-specifier specifies which
other methods can call this method. Most
methods shall be declared as public.
2. Return-type is the type of the value
that is returned by the method to its caller.
If no value returned by a method, then the
keyword void should be specified in the
place of type.
155. Methods – General Form
⚫Here,
3. Method-name is the name assigned to the
method by the user. It shall be any valid
identifier.
4. Parameter-list is a list of parameters.
This list, always enclosed in parentheses
contains parameter names and their
types. The values that we want to pass
on to the method as input .
156. Methods – General Form
⚫The parameters in the parameter list should be
separated by commas.
⚫In no input data are to be provided to a method,
then the method name should be followed by pair
of empty parentheses.
⚫The body of the method contains a set of variables
and a set of statements.
⚫The statements in a method describe the
operations that are performed by the method.
157. Methods – General Form
⚫The variables that are declared in the method are
know as local variables.
⚫The local variables and the parameters associated with
a method. They are removed from the memory, when
the control comes out of the method.
⚫Local variables should be always initialized.
⚫A method may be instructed to return a value after its
execution is over. A special statement namely the
return statement of the following form shall be used for
this purpose
return expression;
158. Methods – General Form - Example
⚫Here, data type of the value yielded by the
expression should be same as the return-type of the
method. Example,
int rectAngleArea()
{
return length * width;
}
⚫Here the value yielded by the expression length *
width should be int, as the return type of the method
rectangleArea() is specified as int.
⚫Method name is rectAngleArea(), return type is int, no
parameters list, inside body only one statement that is
160. Methods – Invoking a Method
⚫Suppose we define a method named product() for
finding the product of two numbers as shown
below:
int product( int a, int b)
{
return a * b;
}
⚫Once we define a method, such as the product()
method, we shall invoke it any number of times.
⚫To use a method, we have to invoke it by
specifying its name with the values for its
161. Methods – Invoking a Method
product()
⚫For example, we shall invoke the
method, as shown below
product(10,6);
product()
⚫When the method is invoked as
specified above, the numbers 10 and 6 will be
passed to the method product().
⚫As a result, the product a * b will be evaluated
as 60 and this value will be returned by the
product() method
162. Methods – Invoking a Method
⚫The value that is returned by a method shall very well
be assigned to a variable and then involved in some
computation. For example, consider the following
assignment statement.
int p = product (10, 6);
⚫Here the value 60, which is returned by the product()
method, will be stored as the value of the variable p.
The value that is returned by a method shall also be
directly displayed on the screen with the help of a
statement of the following form:
163. Methods – Invoking a Method
⚫Here the value 60, which is returned by the
product() method will be displayed on the screen
along with the string
“Product of two numbers = ” as shown below:
Product of two numbers = 60
165. Methods –Method Overloading
⚫When two methods in a class have the same name
but different parameter lists, those two methods
are said to be overloaded.
⚫Advantage of method overloading?
Method overloading increases the readability
of the
program.
⚫There are two ways to overload the method in
java, By changing
1. Number of arguments
2. By changing the data type
168. Methods – Recursion
⚫ A method can invoke another method. It can also invoke
itself. Such a method is known as a recursive
method.
⚫ The definition of a recursive method has the
following two parts
1. The basis, which defines the value of a recursive function
for the first one or few values of the parameter(s).
2. The recurrence relationship, which expresses
the value.
169. Methods – Recursion
⚫For example, let us consider the following
recursive method factorial().
static int factorial (int m)
{
if( m==1 )
return 1;
return m * factorial ( m – 1);
}
170. Methods – Recursion
⚫Here the factorial of 1 is 1. This is the basis.
⚫The factorial of m can be found from the expression
m * factorial ( m – 1). This is the recurrence
relationship.
⚫Suppose we invoke the above recursive method
factorial() with the argument 3, as shown below.
factorial(3);
⚫Now, the factorial() method will return the following
expression:
3 * factorial(2);
171. Methods – Recursion
⚫So, the next call to the factorial() method will
be as follows:
factorial(2);
⚫Now, the factorial() method will return the
following expression
2 * factorial(1);
⚫So, the next call to the factorial() method will
be as follows:
factorial(1);
172. Methods – Recursion
⚫Since the factorial() method is invoked with the
argument 1at this stage, this method will return the
value 1.
⚫At this stage, factorial(2) will be computed as 2.
⚫Then the factorial(3) will be computed as 6.
174. java.util.Random Class
⚫The java.util.Random class instance is used to
generate a stream of pseudorandom numbers.
Following are the important points about Random:
⚫The class uses a 48-bit seed, which is modified
using a linear congruential formula.
⚫The algorithms implemented by class Random
use a protected utility method that on each
invocation can supply up to 32 pseudorandomly
generated bits.
175. java.util.Random Class Constructors
1. Random()
This creates a new random number
generator.
number
2. Random(long seed)
This creates a new random
generator using a single long seed.
176. java.util.Random Class Methods
1. protected int next(int bits)
This method generates the next
pseudorandom number.
2. boolean nextBoolean()
This method returns the next pseudorandom,
uniformly distributed boolean value from this random
number generator's sequence.
3. void nextBytes(byte[] bytes)
This method generates random bytes and
177. java.util.Random Class Methods
4. double nextDouble()
This method returns the next pseudorandom, uniformly
distributed double value between 0.0 and 1.0 from this random
number generator's sequence.
5. float nextFloat()
This method returns the next pseudorandom, uniformly
distributed float value between 0.0 and 1.0 from this random
number generator's sequence.
6. double nextGaussian()
This method returns the next pseudorandom, Gaussian
("normally") distributed double value with mean 0.0 and standard
deviation 1.0 from this random number generator's sequence.
178. java.util.Random Class Methods
7. int nextInt()
This method returns the next pseudorandom,
from this random
uniformly distributed int value
number generator's sequence.
8. int nextInt(int n)
This method returns a pseudorandom,
uniformly distributed int value between 0 (inclusive)
and the specified value (exclusive), drawn from this
random number generator's sequence.
179. java.util.Random Class Methods
9. long nextLong()
This method returns the next pseudorandom,
uniformly distributed long value from this random
number generator's sequence.
10. void setSeed(long seed)
This method sets the seed of this random
number generator using a single long seed.