Java in Hindi

May 12, 2017 | Author: Vipin Sharma | Category: N/A
Share Embed Donate


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

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF