Java in Hindi
May 12, 2017 | Author: Vipin Sharma | Category: N/A
Short Description
This is third edition of "java in Hindi"series. With this eBook your can learn java in Hindi....
Description
www.besthinditutorials.com
Java in Hindi Third Edition By Prof. V.K. Sharma
2015
www.besthinditutorials.com
You can download this EBook from www.besthinditutorials.com
Java in Hindi Third Edition V.K. SHARMA
www.besthinditutorials.com
You can download this EBook from www.besthinditutorials.com
©Copyright 2015 by www.besthinditutorials.com This EBook may not be duplicated in any way without the express written consent of the publisher, except in the form of brief excerpts or quotations for the purpose of review. The information contained herein is for the personal use of reader and may not be incorporated in any commercial programs, other books, databases, or any kind of software without written consent of the publisher. Making copies of this EBook or any portion thereof for any purpose other than your own is violation of copyright laws.
This edition has been published by www.besthinditutorials.com
Limits of Liability/disclaimer of Warranty: The author and publisher have used their best efforts in preparing this EBook. www.besthinditutorials.com makes no representation or warranties with respect to the accuracy or completeness of the contents of this book, and specifically disclaims any implied warranties which extend beyond the descriptions contained in this paragraph. No warranty may be created or extended by sales representatives or written sales materials. The accuracy and completeness of the information provided herein and the opinions stated herein are not guaranteed or warranted to produce any particular results and the advice and strategies contained herein may not be suitable for every individual. www.besthinditutorials.com shall not be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages.
Trademarks: All brand names and product names used in this EBook are trademarks, registered trademarks, or trade names of their respective holders. www.besthinditutorials.com is not associated with any product or vendor mentioned in this EBook.
Reprint Edition: 2013
Published By: www.besthinditutorials.com
You can download this EBook from www.besthinditutorials.com
Contents 1.
2.
3.
4.
5.
6.
7.
8.
9.
INTRODUCTION TO JAVA 1.1. History of java 1.2. Features of java 1.3. OO principles of java 1.4. Java vs. c and c++ INSTALLING JAVA 2.1. Java development tools 2.2. Downloading java 2.3. Installing java and setting environment variables 2.4. Download eclipse 2.5. Installing eclipse FIRST JAVA PROGRAM 3.1. Running a java program 3.2. Hello world program DATA TYPES 4.1. What are data types? 4.2. Integer 4.3. Float 4.4. Character 4.5. Boolean VARIABLES 5.1. What are variables? 5.2. Types of variables 5.3. Creating variables STRINGS 6.1. What are strings? 6.2. Operations on strings ARRAYS 7.1. What are arrays? 7.2. Creating an array 7.3. Initializing an array 7.4. Displaying an array OPERATORS 8.1. What are operators? 8.2. Types of operators Control Statements 9.1. What are control statements? 9.2. Types of control statements
You can download this EBook from www.besthinditutorials.com
10. CLASSES 10.1. What are classes? 10.2. Advantages of classes 10.3. Creating a class 11. OBJECTS 11.1. What are Objects 11.2. Steps to create an object 12. CONSTRUCTORS 12.1. What are constructors? 12.2. Rules for creating constructors 12.3. Types of constructors 13. METHODS 13.1. What are methods? 13.2. Structure of method definition and method call 14. INHERITANCE 14.1. What is inheritance? 14.2. Types of inheritance 14.3. Inheriting a class 14.4. Example 15. Exception Handling 15.1. What are exceptions? 15.2. Keywords(try, throw, catch) 15.3. Example 16. Interfaces and packages 16.1. What are interfaces? 16.2. Example 16.3. What are packages? 16.4. Creating a package 16.5. Using a package 16.6. Some common java packages 17. Multithreading 17.1. What is multithreading? 17.2. Thread class 17.3. Runnable interface 17.4. Synchronization 18. File I/O 18.1. What are streams? 18.2. Byte streams 18.3. Character streams 19. Serialization 19.1. What is serialization?
You can download this EBook from www.besthinditutorials.com
20.
21.
22.
23.
24.
25.
26.
27.
19.2. Serializable interface Collections Framework 20.1. Collection interface 20.2. Other interfaces Lambda Expressions 21.1. What is functional interface? 21.2. What is lambda expression? Generics 22.1. What are generics? 22.2. Generic classes 22.3. Generic methods Applets 23.1. What are applets? 23.2. Applets life cycle methods 23.3. Example AWT(Abstract Windows Toolkit) 24.1. What is AWT? 24.2. Container classes 24.3. Component classes 24.4. Frame class Servlets 25.1. Architecture of servlets 25.2. Life cycle of servlets 25.3. Example Swing 26.1. What is swing? 26.2. Features of swing 26.3. Swing classes 26.4. Example Index
You can download this EBook from www.besthinditutorials.com
Preface The idea of writing a book about Java Development in Hindi can be somewhat futile at times, considering the pace at which Java continues to expand, morph and change. What started out as a book project two years ago has now become a series of updates to the original work with the page count nearly double the original project and that after making hard decisions about what to leave out of the book to make sure it gets liked. This update to Java in Hindi represents our latest effort to provide coverage on important Java Development topics, namely the expansion into the Swing. Like many things in life, the only constant is change, but by now we are somewhat accustomed to the rapid-fire environment of Java Development. To the end, we have ensured that all the programs work with eclipse as well as without eclipse. The third edition is written by Vipin Kumar Sharma. Thank you for learning and collaborating with us.
VIPIN KUMAR SHARMA
You can download this EBook from www.besthinditutorials.com
Acknowledgement Writing a third edition of Java in Hindi feels somewhat like the old saying about weddings: “Something old, something new…” The deadline for the third edition did not become any easier as at last count there are still only 24 hours in the day. And as for something new it seems as though Java‟s pace of innovation is continuing to match its adoption rate by users around the globe.
In particular, we‟d like to acknowledge and thank everyone at www.besthinditutorials.com. Firstly I would like to thank our EBook Designers and editors, who have been involved in every aspect of now three editions of this project. I would also like to thank our publisher to bring this masterpiece in EBook format.
You can download this EBook from www.besthinditutorials.com
About this book Java in Hindi, Third Edition is a revision and update of the second edition published in 2013. This third edition adds new content related to java 8. Like its predecessors, this book covers important beginner topics such as “What is Java?” and installing and using the development environment. We than advance to practical working examples of core programming topics any developer will be happy to have at the ready on the reference shelf. The remaining chapter‟s present detailed example applications covering advanced topics, including AWT and Swing. Although you can read the book from start to finish, you can also consider it a few books in one. If you are new to Java focus first on beginning chapters. With the foundation you can work your way up to last chapter.
Who should read this book? We wrote this book for professional programmers and hobbyists alike. Many of the concepts can absorbed without specific Java language knowledge. If you have c, c++ or c# knowledge, you will be able to follow the examples. Prior eclipse experience is helpful, but not required. A number of good resources are available on java and eclipse to augment the content of this book. And lastly the person who is willing to learn java in his mother tongue Hindi should read this book.
Road map 1. Basic – first 10 chapters contain basic information regarding java programming. 2. Intermediate – next 10 chapters are somewhat of intermediate level and necessary java topics. 3. Advanced – remaining chapters covers some advanced topics of java language.
You can download this EBook from www.besthinditutorials.com
Chapter 1 Introduction This chapter covers
History of Java Features of Java OO Principles Java vs. c and c++
History of Java Java एक general purpose object oriented
. Sun Microsystems
. Java क क
U.S develop क
. Java क
Java James Gosling Java क एक
क क
oak
क
ए
क क java क
develop क
औ
क java platform independent
क
क execute क
क
java 1991
क
ए
ए
. Java
. Java क
क java क
.
क
java क
.
Features of Java java क क ए
क
क
क
क
. एक
java
.
क java
क
ए.
1. Compiled and Interpreted compiled approaches क combine क compile क क क
.
interpreted
औ एक two
क
generate क
क
क
क क
.
. क क
instructions generate क
क
java .
ए java
directly execute क
You can download this EBook from www.besthinditutorials.com 2. Platform Independent Java क
क .
क
क
क
.
क
एक
क
क
.
एक क
क
ए
क
ए क
JVM
generate क
क
generate
ए
क
.
execute
JVM उ
machines क
क
क
क JVM क
.औ
क क
.
क
ए क
क . Java क
क
क compile क
java
क
JVM (java virtual machine) JVM
क
क
ए
क
क
क
क
JVM
generate क
generate
क
. .
एक
क
.
3. Object Oriented Java एक true
ए
क
. Java क
. Java
.
4. Robust and Secure Java एक robust
क java
technologies क
क crash ए क
reliable
क
क
क
क
क
. Java
क
.
JVM क
Java
environments
क
क
.
क क invalid combinations क
generate क क
JVM
.
5. Distributed Java
ए क
distributed applications
औ एक
networks क
क
. Distributed applications
क task क
applications
क
क
RMI क
. Java
.
6. Simple and Familiar Java एक
. Java क
c औ c++
ए ए
java क easy to
declarations, control statements, methods declarations understand
क variables
.
क java c औ c++ क
क c औ c++
.
ए java क
क
क
क familiar java क
क
क
.
7. Multi-threaded and interactive Java एक multi-threaded java क
औ
8. High Performance
.क
java .
एक
क
क
क
क
.
You can download this EBook from www.besthinditutorials.com Java क performance c औ c++
impressive . Java क
क
क
क
reason
क java क architecture
. क
. Java क
क
क java
.
9. Dynamic and Extensible Java एक dynamic क
. Java
औ
,
क
dynamic
.
Java क
क
क
क
java एक extensible
.
औ
क
क
क
.
10. Ease of Development develop क
Java क
क
. Java
ए
क
.
क ए
क क
क
क
क
क
. .
.
Object oriented principles of java क
java एक
ए
क क
ए
क
ए
. Java क
क
principles क
.
-
1. Encapsulation Encapsulation क data hiding औ उ
क
क
क
ए
क ए औ क
(variables) औ क
ए
. Encapsulation .
ए
क
.
क एक
क ए
क क
bind क
(Methods) एक
क .क
क
औ
. Encapsulation क
ए
क क
. Java 3
क . क
hiding
क
Public -
क
क
Private -
ए
क क
Protected -
क
ए
क क
क
क
.
क ए
क
क
.
ए
क
क
2. Inheritance क क
एक
एक
क क
ए
औ क
क .
क
क
. औ
You can download this EBook from www.besthinditutorials.com क क
. Java क
क
.
क
. एक
allow क
java
क
एक
.
3. Polymorphism Polymorphism क ए
,क
"एक
क according
क ". Polymorphism क क
actions
एक
क
.
क
.
4. Abstraction Abstraction java क कक क
औ
. क
.
क
concept . same क
क
क
क
. क
.
क
क
क
क
क कक
क
क
क
क
क
क क
.
क
.
Java vs. c and c++ Java vs C एक object oriented programming language
1.
क
क
program objects
क C एक procedural language . औ C
क
क
functions
. एक interpreted औ compiled language
2.
language क क
क
directly JVM उ
convert
क 4.
क
convert क
convert क
एक high level language
3.
क C एक compiled language . C
क C एक low
क
क
. language . C language machine क
. bottom up approach
ए
क
क
क
क C top down approach क
कC
क
ए
. ए
. pointers क
5.
कC
क pointers क handle क
क
. memory क automatically
6.
कC
क
क
क
क
8. error
उ क
. C overloading क उ
error क
automatic garbage collection
.
.
overloading क support क
7.
.
क
exception handling क क
.
क क
. क C
You can download this EBook from www.besthinditutorials.com
Java Vs C++ 1. C++ structures, unions, templates, operator overloading औ pointers क support क क
क
2. C++
क
collection
.
3.
threads क
क
ए destructors
ए built in support क
क
क
क
क
. C++
क क
.
क C++
automatic garbage
threads third party
scope resolution operator(::)
क
औ
क
resolution operators क
5. C++
goto statement
6. C++
method overloading
method overloading
.
.
default arguments
arguments
क
support
क
libraries क 4. C++
क
.
8. C++ compiled language
goto statement
operator overloading क support क औ
क
क compiled
.
क
default
. .
औ operator overloading
.
7. C++ क क
क
क
क
. क
.
platform independent
औ interpreted
.
You can download this EBook from www.besthinditutorials.com
Chapter 2 Installing Java This chapter covers
Java development tools Installing java and eclipse
Java Development Tools
JDK(Java Development Kit) JDK एक ए क
क
क
. JDK
ए क
क
JRE
क
क execution क
औ उ क execute ए
.
JRE(Java Runtime Environment) क execution क
JRE (Java Runtime Environment ) क
औ
ए
क
ए क
एक
क
ए
. JRE
क execute
क
ए
.
JRE क 2 क 1.
क
2.
क execution
क
JVM(Java Virtual Machine) क क
क .
क
क
क
Machine ) एक environment JRE क
क
क
.
क compile क क
convert क
क
क . JVM (Java Virtual क
convert क
.
You can download this EBook from www.besthinditutorials.com
Installing java and eclipse Java क क
औ command prompt क क
उ
क
. एक
command prompt version
क java
.
उ क
क
2
क
क official
. क
एक
क
उ
क
औ
क
क
क
उ
क
क क
editor
क IDE
. क
environment क NetBeans IDE milega
उ
क
Eclipse
.
Java command prompt platform औ NetBeans IDE
उ
क
क
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Eclipse IDE उ क क http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/marsr
-
You can download this EBook from www.besthinditutorials.com
Chapter 3 First Java Program This chapter covers
Running a java program Hello world program
Running a java program क
क
क
क
क2
notepad क
क
.
औ console
console
क
IDE क use
java उ
क
क
. क
क
ए
1. Through IDE (Integrated Development Environment) 2. Through Console Through IDE IDE
क
कक
क .
IDE
कक एक IDE
उ
क
क
क
क Eclipse, NetBeans IDE Java Compiler क execute क क .
क .
औ .
क
क
You can download this EBook from www.besthinditutorials.com
Through Console Console 1. Run
क
program cmd
क
2. Command prompt
क steps
ए ए .
औ command prompt
क
क
क
उ drive
एक
क
install
औ
क
bin folder क locate क
3. क
क क
कक औ enter
क
क
क
क
क image
क क
ए
javac
You can download this EBook from www.besthinditutorials.com
क
4. MyProgram.java.
उ
क
क
prompt
.java extension
क javac MyProgram.java औ ए
errors executable file
ए क
क
javac command enter
क
औ
क क
क .
क क क
You can download this EBook from www.besthinditutorials.com java क
5.
क
क
औ ए
क
क
java MyProgram.
Hello world program एक simple
क
क
क
क औ
क
क
copy क
औ
क
lecturer एक
board
simple
.
You can download this EBook from www.besthinditutorials.com क
notepad क
औ उ
क
क java program
chapter 2 ढ़
क
inverted commas (" ") क
एक message एक
.
औ main
HelloJava
क क
println
क क
ए क
क
क
ए description क
क
क
. क
औ
public - public एक access modifier . Access modifiers 3 protected) औ
क members क ए
क
क क
क
.
(public, private, क
.
क
tutorials एक क
class -
ए क क
important concept
static क
क
क
HelloJava keyword क
.
क
क
method क
कक क main
program क execute क
क
ए access क
एक
main -
main
क
ए क
System.out.println () command prompt screen
ए
क
.
क java run time environment
. क
क execution उ
.
.
string array command line arguments क
क execute क
क
.
. Class क
क
String args [] -
कक
argument
क
क
ए
क
.
system एक package , out एक उ
क
क
ए
.
क
, औ println एक .
You can download this EBook from www.besthinditutorials.com
Chapter 4 Data Types This chapter covers
What are data types? Integer Float Character Boolean
What are data types? Data, data औ data. क क
क
available क उ क
.
. क क
.
क उ
क according क
???
उ क
क
.
.क
औ क
. operations क
.
operations क
क
perform
operations क
and Division)
ए
.
(Addition, Subtraction ,Multiplication
perform क
क 4क
categories
क
क
.
-
Integer Integers क
क क
( 4क
क
क क
क
. क
) include .
क
क .
क
क
क
क उ क
क
-
Byte क
8 क
Example - int age = 40;
. -127
क 128 क क क क
क
क क
क
क क
. .
You can download this EBook from www.besthinditutorials.com
Short क
16
.
क 32,767 क क क
-32,768
क
क
. Example - short sal = 25,000 Int Int क
32
.
commonly
क 2,147,483,747 क क
क
. Int क
-2,147,483,648
.
Example - int population = 2,00,000,000; Long क
64
क
.
क
.
Example - Long WorldPopulation = 8,00,00,00,00,00,00;
Floating-Point Numbers numbers क
.
क
( क क
क
क 2क
क
क
क क
.
क
क
) .
-
Float क क 3.4e+038 क क
क क
क
. क
32
. क
.
1.4e-045
क
एक
क
. Example - float temp=34.4; Double क क 1.8e+308 क क क
.
Example - double pi = 3.1416;
क
.
क
क
क
.
64
. क
4.9e-324 ७
क
क
You can download this EBook from www.besthinditutorials.com
Character क क
एक
क
क
क
क char क
ए क
क
क
क
ए
क
.क
क
16
.
.
Example - char FavLang = „c‟;
Boolean ए क
क
क decision true
क
false.
Example - boolean isFivemorethanOne = “true”;
.
ए
क
2
You can download this EBook from www.besthinditutorials.com
Chapter 5 Variables This chapter covers
What are variables? Types of variables Creating variables
What are variables? क
information क उ
ए
क
औ उ क उ क
ए ए
ए
ए
changeable क
ए .
ए
क
.
क
उ
क
क .
क . एक
.
.
. Variable
क
क ए
क
constant क
क
ए क
ए
क
क
. क
क
क
क
क
क create क
क
क
. औ उ information क
क
ए ए
.
क
.
क
क
क
2
.
क
क उ
.
ए
क .
ए
उ क उ
क
error generate क
ए
क
क
क
ए
information क
.
change
Information क
क .
क
क
ए
क क
औ एक
क
क
क
क क
क क
क क
क
क
ए data type
क
You can download this EBook from www.besthinditutorials.com
Types of Variables in Java
ए
Java
क उ क scope क
2
-
Local Variables क उ
क
ए
ए
क क
क ए
क
क
ए क
उ
ए उ
.
क
क
उ
ए क
उ
क
क ए
क क
.
. .
Global Variables क
variable क
क
क
उ variable क
क
ए
.
उ
क
ए
.
global variables क
.
क ए
.
क
क scope
.
Creating Variables
ए
Java
create क
क 2
stages क
.
क
क
.
Variable Declaration ए .
क
औ
क
क
क
क
-
Example - int PersonAge; Variable Initialization ए
क
क
.
-
Example - PersonAge = 24; क
एक
क
क
-
Example - int PersonAge = 24. क initialize
क क
ए declare क क
क
ए .
क
You can download this EBook from www.besthinditutorials.com क argument क
क
ए
(System.in)
nextInt(), nextLine(),nextFloat
क
Scanner क क
क
. क
ए क क
एउ
.
Example -
int PersonAge; // variable declaration Scanner s = new Scanner(System.in); // Scanner class object PersonAge = s.nextInt(); // reading from keyboard
औ उ
You can download this EBook from www.besthinditutorials.com
Chapter 6 Strings This chapter covers
What are strings? Operations on strings
What are strings? characters क sequence implement क क
ए क
.
क compare क
.
. String एक
क
क
2 औ
strings क objects क
"I am fan of java". Java
क
operations .
normal variables क
क object
ए क
क
क
2
string क
.
Example
String क एक variable क क .
क
क ऊ
MyString
औ एक object क एक
क ए
क क
क उ क
क क
क क
क
"this is a string "
You can download this EBook from www.besthinditutorials.com क
क क
क
क
क
क
.
string क variable क
क
उ
.
methods
provide क
क
modification क
string object
एक
generate
क
string object
क
क
.
Operations on Strings
String Length क
string
length( )
उ string क length
characters क
क
.
क
ए
उ
. क
क
length( ) method call क
.
Example
String Concatenation क Example
strings क
क एक
क
.
string concatenation क
.
You can download this EBook from www.besthinditutorials.com क concat ( )
क
.
Example
charAt( ) method method array क Example
क indexing
एक character क extract क ए
उ क क
क
ए
क
. क
एक character क extract क
string क क
.
You can download this EBook from www.besthinditutorials.com
Equals( ) method क compare क क
false
औ
equal एक
.
क compare क
क
क क
argument क
क
true क
क
औ
.
Example
indexOf( ) method क
string क
index
क
ए
sub-string extract क
क
sub-string
क
क
उ क
.
क
.
Example
substring( ) method क
index औ end index argument क string
क
.
क
ए
क .
. start index
start end index क क
You can download this EBook from www.besthinditutorials.com
Example
You can download this EBook from www.besthinditutorials.com
Chapter 7 Arrays This chapter covers
What are arrays? Creating an array Initializing an array Displaying an array
What are arrays? क
Array क
.
syllabus क
array
. Arrays एक programming
Array similar क क
.
क need
क variables क क क array
ए
क
. Array
employees क salary क array क
औ
क
क
क क
. topic
word क
programming
.
क
similar employees क
क int, float, char
क
क .
क
You can download this EBook from www.besthinditutorials.com array
ए क
उ
क
variables उ
क
size क
उ क index क
BCA क
access क
array क
4
.
ए
क
क
क
6
क array क index
Arrays क index
क
. Array क
.
एक classmate
.
ए क
array
arrays उ
element
first ए
क
क
lecturer
array क क
. .
ए
zero
array क
array क
n
element (n -1)
array क size 5
क array क
array क index
क
element 22 4th
.
Creating an array Java
array
ए क
.
क
क
ए क
.
type array_Name = new type[sizeofarray]; क array
type array_Name new =
array क
keyword
size of array -
.
ए क क
ए
array क memory allocate क array क
Example
int salary = new int[10];
.
ए
क
ए array
क
. क
.
You can download this EBook from www.besthinditutorials.com
Initializing an array Arrays क
initialize क
2
क
array क क क
. एक क
एक particular index
ए
क
क
कक
.
क
.
Example
salary [4 ] = 10000; ऊ
array क
एक
ए औ उ
ए ए
एक एक
क
array
Example
Scanner s = new Scanner(System.in) for(int i=0; i
View more...
Comments