SlideShare a Scribd company logo
1 of 22
Page 1 of 22
COMPUTER PROJECT
Created By: Prarabdh Garg
Standard: X-A
Roll Number: 9
Topic: A program on Cricket
Page 2 of 22
CERTIFICATE
This is to certify that Prarabdh Garg of class X has
successfully completed a project on the topic “A
program on cricket” prescribed by Mrs. Vaishali
Bhirud, during the academic session 2015-16 as per the
guideline issues by Indian Certificate of Secondary
Education.
Internal Examiner External Examiner
Page 3 of 22
ACKNOWLEDGEMENT
I, Prarabdh Garg, would like to extend my heartfelt
gratitude towards my computer teacher, and my principal for
givingme anopportunitytowork on thisproject. Thisproject not
only helped me unleash many new horizons in the field of
programing, but also helped me in knowing more about the
subject.
I would also like to thank my parents and my friends who
encouraged me towards working on this project and to do my
best. It wasonlybecause of them that I wasableto complete this
project with wonderful learning.
Internal Examiner External Examiner
Page 4 of 22
CONTENTS
I. Object Oriented Programing Concepts
II. Introductionto a Class
III. Functions
IV. Constructors
V. Class as A User Defined Type
VI. Decision Making
VII. Iterations
VIII. Using Library Classes
IX. Encapsulation
X. Arrays
XI. Input/output
XII. The program on cricket
XIII. The Output
Page 5 of 22
Object Oriented Programing Concepts
here are two ways of organizing a program.
One is around the approach, known as the
process oriented model. The other way is
around its data, and is known as the Object Oriented
Model. Java is an Object oriented model, in which
objects can be considered as a partitioned area of
the computer memory to store and access data.
OBJECTS
An object is a software bundle of variables and
related methods. They have a state and a
behavior, and resemble real-world objects. The
state and behavior of objects are expressed in
the form of variables and methods.
T
Page 6 of 22
CLASS
A class is a prototype which defines the variables
and methods common to all objects of a certain
kind.
Page 7 of 22
INTRODUCTION TO A CLASS
s we know, Java is an Object Oriented
Program, made up of several basic elements.
These are:
 Whitespaces: There are no special indentation
rules in Java.
 Identifiers: Symbolic names used for various
data items in a program.
 Keywords: Reserved words which convey a
special meaning to the compiler
 Constants: A data item whose value cannot be
changed throughout the program. They are also
known as literals
 Comments: Remarks from a programmer which
are ignored by the compiler.
A
Page 8 of 22
 Operators: A symbol or a letter which makes the
compiler perform specific operations on
operands in a program.
OPERATORS
Arithmetic
Binary Unary
Relational Logical Assignment Tertiary
Page 9 of 22
1-Everyone canaccess 2-Name of the class 3-Cannotbe accessedwithoutobject
4-Noreturn type 5-Functiontoprinta statement
6-What to print 7-To terminate astatement
Page 10 of 22
Page 11 of 22
FUNCTIONS
unctions are sub-programs within the main
program, whose main function is to process
and return data. The syntax for defining a
function is:
[Access specifier][Static][return type] name of
program(parameters)
{
//Body of the function
}
Classification of Functions
1. Predefined functions: These are functions
which are already available with the java
package and can be used by importing the
package.
F
Page 12 of 22
2. User defined Functions: These are functions
defined by the user within the program to
perform a particular task.
3. Pure Functions: These are functions generally
contain a return statement, and their main use is
to provide or print values. They do not
manipulate the values.
4. Impure Functions: These are functions which
manipulate the data and also provides the new
values to the program.
Overloading Functions
The process of having two or more functions with the
same name but different parameter declaration is
known as function overloading. Function
overloading is one of the ways in which java
implements polymorphism. The number and types
of arguments passed are used to decide which
function would be invoked.
THE ‘this’ KEYWORD
The ‘this’ keyword can be used inside any method
to refer to the current object.
Page 13 of 22
CONSTRUCTORS
ava allows objects to initialize themselves when
they are created. This automatic initialization of
objects during their creation is done by a special
function of the class called constructor.
The syntax for defining a constructor is:
classname()
{
statements;
}
Characteristics of constructors
1. Every constructor has the same name as that of
the class.
2. It has no return type, but can accept arguments
3. A class can have more than 1 constructor.
4.Default constructors don’t accept parameters
J
Page 14 of 22
Types of constructors
1.Parameterized Constructor: Constructors that
can take arguments are known as parameterized
constructors.
2. Copy Constructor: When we create a new
object with the same state as that of another
object, a copy constructor is created.
3. Default Constructor: This constructor is one
which cannot take any arguments, and its only
function is to set the values to null.
Page 15 of 22
CLASS AS A USER DEFINED CLASS
Wrapper Classes
rapper classes form a part of standard
library of Java.lang package which
provides many methods to help
manipulate primitive data types.
The chief wrapper classes with their functions are:
1. Integer class(Integer.): parseInt(), valueOf(),
toBinaryString(), toOctalString(), toHexString(),
toString()
2. Character class(Character.): isLowerCase(),
isUpperCase(), isDigit(), isLetter(),
isWhitespace(), toUpperCase(), toLowerCase()
3. Double class(Double.): parseDouble(),
toString() , valueOf()
W
Page 16 of 22
DESCISION MAKING
t may be required in a program to cause the flow
of execution not to advance in linear sequence,
but branch to some statement, based on changes
to the state of a program. These can be catagorised
as selection, iteration and jump.
Selection Statements
Selection statements allow the selective execution of
statements, enabling decision and subsequent
selection of some of the several possible actions.
Some of the selection statements are:
If switch case
if-else ternary operator
if-else-if
I
Page 17 of 22
ITERATONS
terations or loops help in repeatedly executing a
set of statements, until a termination condition is
met. The two types of loops are:
1. Entry Control: In these loops, the test
expression if first checked, and then the
statements are evaluated.
2. Exit control: In these loops, the statements are
executed, and then the test expression is
checked. The minimum number of iterations is
one.
The three main loops, which are the most widely
used are:
1. For Loop(Entry Control)
2. While Loop(Entry Control)
3. Do while Loop(Exit Control)
I
Page 18 of 22
USING LIBRARY CLASSES
he built-in functions which are used by the
programmer are stored in their respective
classes, present in their respective packages.
These functions provide the basic functionality of
Java.
Methods in String class
The methods that are present in the String class
helps in manipulating String data in many ways.
Some of the methods that are present include
length(), trim(), charAt(), equals(),
equalsIgnoreCase(), and may others.
Methods in Math class
The methods that are present in the Math class helps
the programmer to use complicated maths problems
simple. It includes random(), ciel(), floor(), round(),
toRadians(), along with many other methods.
T
Page 19 of 22
ENCAPSULATION
ncapsulation is an OOP principle the binds the
code and data, keeping it safe from outside
access and misuse. It acts like a protective
covering that prevents the code from being accessed
from outside.
Inheritance
Inheritance is another basic OOP principle, which
enables one class to acquire attributes and behavior
from its super class.
The three types of inheritance are:
1.Simple Inheritance
2.Hierarchical Inheritance
3.Multi-level Inheritance
E
Page 20 of 22
ARRAYS
n array can be defined as a set of homologous
data elements sorted in a contiguous
memory location. A specific element in an
array can be accessed by its index. The first element
has the index 0, and it increases by one for each
subsequent element.
Creating an array
To create an array, the syntax is:
Datatype [] variable name=new data type[array size]
As with declarations for variables of other types, the
declaration of an array variable does not allocate any
memory to contain the array elements. We must
assign a value to the array variable before the name
of the variable refers to a memory location.
A
Page 21 of 22
INPUT / OUTPUT
ava employs the notion of a stream as an
abstraction for all possible data sources. A
stream might be receiving bytes from or sending
bytes to a file, a String object, a keyboard, etc. The
main characteristics of a stream are:
 Sequence of bytes
 Contain either binary or character data
 For reading, an input stream is used
 For writing, an output stream is used
 If a stream has buffer memory, it is known as
Buffer Stream
The two main types of streams that are used are:
1.Bytes Stream: This stream takes the input or
displays the output in a package of 8 bits, or a
byte.
2. Character Stream: This stream takes the input,
or shows the output through characters.
J
Page 22 of 22
BIBLOGRAPHY
Books:
1.Total Computers for class X
2.Understanding Computers class X
Websites:
1. www.javapoint.com
2. www.tutorialpoint.com
3.www.wikipedia.com

More Related Content

What's hot

What's hot (20)

Unit 1 Java
Unit 1 JavaUnit 1 Java
Unit 1 Java
 
Class method
Class methodClass method
Class method
 
Java interfaces
Java   interfacesJava   interfaces
Java interfaces
 
Abap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialsAbap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorials
 
Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5
 
Java notes
Java notesJava notes
Java notes
 
Object Oriented Programming using JAVA Notes
Object Oriented Programming using JAVA Notes Object Oriented Programming using JAVA Notes
Object Oriented Programming using JAVA Notes
 
Interface
InterfaceInterface
Interface
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
Ppt chapter03
Ppt chapter03Ppt chapter03
Ppt chapter03
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
 
java interface and packages
java interface and packagesjava interface and packages
java interface and packages
 
SQL Interview Questions For Experienced
SQL Interview Questions For ExperiencedSQL Interview Questions For Experienced
SQL Interview Questions For Experienced
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
 
C#
C#C#
C#
 
Class and object
Class and objectClass and object
Class and object
 
Delphi qa
Delphi qaDelphi qa
Delphi qa
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
 
C# interview
C# interviewC# interview
C# interview
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
 

Similar to Basics of Java

Tcs NQTExam technical questions
Tcs NQTExam technical questionsTcs NQTExam technical questions
Tcs NQTExam technical questionsAniketBhandare2
 
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptxINDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptxIndu65
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerJeba Moses
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to JavaSMIJava
 
Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1SURBHI SAROHA
 
Selenium Training .pptx
Selenium Training .pptxSelenium Training .pptx
Selenium Training .pptxSajidTk2
 
OOP in Java Presentation.pptx
OOP in Java Presentation.pptxOOP in Java Presentation.pptx
OOP in Java Presentation.pptxmrxyz19
 
Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ ProgrammingPreeti Kashyap
 
Technical_Interview_Questions.pdf
Technical_Interview_Questions.pdfTechnical_Interview_Questions.pdf
Technical_Interview_Questions.pdfadityashukla939020
 
Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersSatyam Jaiswal
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2Rakesh Madugula
 

Similar to Basics of Java (20)

Question bank unit i
Question bank unit iQuestion bank unit i
Question bank unit i
 
Tcs NQTExam technical questions
Tcs NQTExam technical questionsTcs NQTExam technical questions
Tcs NQTExam technical questions
 
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptxINDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
 
Intervies
InterviesIntervies
Intervies
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
 
Java
JavaJava
Java
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
 
Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1
 
Selenium Training .pptx
Selenium Training .pptxSelenium Training .pptx
Selenium Training .pptx
 
Unit 1
Unit  1Unit  1
Unit 1
 
OOP in Java Presentation.pptx
OOP in Java Presentation.pptxOOP in Java Presentation.pptx
OOP in Java Presentation.pptx
 
Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ Programming
 
Technical_Interview_Questions.pdf
Technical_Interview_Questions.pdfTechnical_Interview_Questions.pdf
Technical_Interview_Questions.pdf
 
VB.net
VB.netVB.net
VB.net
 
Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & Answers
 
Java scjp-part1
Java scjp-part1Java scjp-part1
Java scjp-part1
 
JAVA-PPT'S.pdf
JAVA-PPT'S.pdfJAVA-PPT'S.pdf
JAVA-PPT'S.pdf
 
Java unit 7
Java unit 7Java unit 7
Java unit 7
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
 
PCSTt11 overview of java
PCSTt11 overview of javaPCSTt11 overview of java
PCSTt11 overview of java
 

Recently uploaded

Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 

Recently uploaded (20)

Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 

Basics of Java

  • 1. Page 1 of 22 COMPUTER PROJECT Created By: Prarabdh Garg Standard: X-A Roll Number: 9 Topic: A program on Cricket
  • 2. Page 2 of 22 CERTIFICATE This is to certify that Prarabdh Garg of class X has successfully completed a project on the topic “A program on cricket” prescribed by Mrs. Vaishali Bhirud, during the academic session 2015-16 as per the guideline issues by Indian Certificate of Secondary Education. Internal Examiner External Examiner
  • 3. Page 3 of 22 ACKNOWLEDGEMENT I, Prarabdh Garg, would like to extend my heartfelt gratitude towards my computer teacher, and my principal for givingme anopportunitytowork on thisproject. Thisproject not only helped me unleash many new horizons in the field of programing, but also helped me in knowing more about the subject. I would also like to thank my parents and my friends who encouraged me towards working on this project and to do my best. It wasonlybecause of them that I wasableto complete this project with wonderful learning. Internal Examiner External Examiner
  • 4. Page 4 of 22 CONTENTS I. Object Oriented Programing Concepts II. Introductionto a Class III. Functions IV. Constructors V. Class as A User Defined Type VI. Decision Making VII. Iterations VIII. Using Library Classes IX. Encapsulation X. Arrays XI. Input/output XII. The program on cricket XIII. The Output
  • 5. Page 5 of 22 Object Oriented Programing Concepts here are two ways of organizing a program. One is around the approach, known as the process oriented model. The other way is around its data, and is known as the Object Oriented Model. Java is an Object oriented model, in which objects can be considered as a partitioned area of the computer memory to store and access data. OBJECTS An object is a software bundle of variables and related methods. They have a state and a behavior, and resemble real-world objects. The state and behavior of objects are expressed in the form of variables and methods. T
  • 6. Page 6 of 22 CLASS A class is a prototype which defines the variables and methods common to all objects of a certain kind.
  • 7. Page 7 of 22 INTRODUCTION TO A CLASS s we know, Java is an Object Oriented Program, made up of several basic elements. These are:  Whitespaces: There are no special indentation rules in Java.  Identifiers: Symbolic names used for various data items in a program.  Keywords: Reserved words which convey a special meaning to the compiler  Constants: A data item whose value cannot be changed throughout the program. They are also known as literals  Comments: Remarks from a programmer which are ignored by the compiler. A
  • 8. Page 8 of 22  Operators: A symbol or a letter which makes the compiler perform specific operations on operands in a program. OPERATORS Arithmetic Binary Unary Relational Logical Assignment Tertiary
  • 9. Page 9 of 22 1-Everyone canaccess 2-Name of the class 3-Cannotbe accessedwithoutobject 4-Noreturn type 5-Functiontoprinta statement 6-What to print 7-To terminate astatement
  • 11. Page 11 of 22 FUNCTIONS unctions are sub-programs within the main program, whose main function is to process and return data. The syntax for defining a function is: [Access specifier][Static][return type] name of program(parameters) { //Body of the function } Classification of Functions 1. Predefined functions: These are functions which are already available with the java package and can be used by importing the package. F
  • 12. Page 12 of 22 2. User defined Functions: These are functions defined by the user within the program to perform a particular task. 3. Pure Functions: These are functions generally contain a return statement, and their main use is to provide or print values. They do not manipulate the values. 4. Impure Functions: These are functions which manipulate the data and also provides the new values to the program. Overloading Functions The process of having two or more functions with the same name but different parameter declaration is known as function overloading. Function overloading is one of the ways in which java implements polymorphism. The number and types of arguments passed are used to decide which function would be invoked. THE ‘this’ KEYWORD The ‘this’ keyword can be used inside any method to refer to the current object.
  • 13. Page 13 of 22 CONSTRUCTORS ava allows objects to initialize themselves when they are created. This automatic initialization of objects during their creation is done by a special function of the class called constructor. The syntax for defining a constructor is: classname() { statements; } Characteristics of constructors 1. Every constructor has the same name as that of the class. 2. It has no return type, but can accept arguments 3. A class can have more than 1 constructor. 4.Default constructors don’t accept parameters J
  • 14. Page 14 of 22 Types of constructors 1.Parameterized Constructor: Constructors that can take arguments are known as parameterized constructors. 2. Copy Constructor: When we create a new object with the same state as that of another object, a copy constructor is created. 3. Default Constructor: This constructor is one which cannot take any arguments, and its only function is to set the values to null.
  • 15. Page 15 of 22 CLASS AS A USER DEFINED CLASS Wrapper Classes rapper classes form a part of standard library of Java.lang package which provides many methods to help manipulate primitive data types. The chief wrapper classes with their functions are: 1. Integer class(Integer.): parseInt(), valueOf(), toBinaryString(), toOctalString(), toHexString(), toString() 2. Character class(Character.): isLowerCase(), isUpperCase(), isDigit(), isLetter(), isWhitespace(), toUpperCase(), toLowerCase() 3. Double class(Double.): parseDouble(), toString() , valueOf() W
  • 16. Page 16 of 22 DESCISION MAKING t may be required in a program to cause the flow of execution not to advance in linear sequence, but branch to some statement, based on changes to the state of a program. These can be catagorised as selection, iteration and jump. Selection Statements Selection statements allow the selective execution of statements, enabling decision and subsequent selection of some of the several possible actions. Some of the selection statements are: If switch case if-else ternary operator if-else-if I
  • 17. Page 17 of 22 ITERATONS terations or loops help in repeatedly executing a set of statements, until a termination condition is met. The two types of loops are: 1. Entry Control: In these loops, the test expression if first checked, and then the statements are evaluated. 2. Exit control: In these loops, the statements are executed, and then the test expression is checked. The minimum number of iterations is one. The three main loops, which are the most widely used are: 1. For Loop(Entry Control) 2. While Loop(Entry Control) 3. Do while Loop(Exit Control) I
  • 18. Page 18 of 22 USING LIBRARY CLASSES he built-in functions which are used by the programmer are stored in their respective classes, present in their respective packages. These functions provide the basic functionality of Java. Methods in String class The methods that are present in the String class helps in manipulating String data in many ways. Some of the methods that are present include length(), trim(), charAt(), equals(), equalsIgnoreCase(), and may others. Methods in Math class The methods that are present in the Math class helps the programmer to use complicated maths problems simple. It includes random(), ciel(), floor(), round(), toRadians(), along with many other methods. T
  • 19. Page 19 of 22 ENCAPSULATION ncapsulation is an OOP principle the binds the code and data, keeping it safe from outside access and misuse. It acts like a protective covering that prevents the code from being accessed from outside. Inheritance Inheritance is another basic OOP principle, which enables one class to acquire attributes and behavior from its super class. The three types of inheritance are: 1.Simple Inheritance 2.Hierarchical Inheritance 3.Multi-level Inheritance E
  • 20. Page 20 of 22 ARRAYS n array can be defined as a set of homologous data elements sorted in a contiguous memory location. A specific element in an array can be accessed by its index. The first element has the index 0, and it increases by one for each subsequent element. Creating an array To create an array, the syntax is: Datatype [] variable name=new data type[array size] As with declarations for variables of other types, the declaration of an array variable does not allocate any memory to contain the array elements. We must assign a value to the array variable before the name of the variable refers to a memory location. A
  • 21. Page 21 of 22 INPUT / OUTPUT ava employs the notion of a stream as an abstraction for all possible data sources. A stream might be receiving bytes from or sending bytes to a file, a String object, a keyboard, etc. The main characteristics of a stream are:  Sequence of bytes  Contain either binary or character data  For reading, an input stream is used  For writing, an output stream is used  If a stream has buffer memory, it is known as Buffer Stream The two main types of streams that are used are: 1.Bytes Stream: This stream takes the input or displays the output in a package of 8 bits, or a byte. 2. Character Stream: This stream takes the input, or shows the output through characters. J
  • 22. Page 22 of 22 BIBLOGRAPHY Books: 1.Total Computers for class X 2.Understanding Computers class X Websites: 1. www.javapoint.com 2. www.tutorialpoint.com 3.www.wikipedia.com