Sunday, 27 May 2018

Java Packages Full Guide In Hindi ~ Search How

Welcome To Tips Arena

Hello friend welcome to our blog tips arena dosto humne apni peechli post main seekha tha Java Interfaces ke bare main or ab hum seekhenge Java Packages ke bare main to aayiye start karte hain.

Java Packages Full Guide In Hindi

Friends agar hum java library ko dhyan se dekhenge to payenge ki usme classes ko unki category ke according different-different packages main organize kiya gya hai. agar hum un classes ko use karna chahte hain to hume packages ko import karna padta hai. kya dosto aap jante hain ki aisa kyo kiya gaya hai ?? classes ko directly bhi to access kiya ja sakta tha.

Dosto packages se hum related types (classes, Interfaces etc.) ka group bna sakte hain. ek package main hum kisi dusre package ko bhi daal sakte hain.

Dosto aapne kabhi socha hai ki kisi ecommerce software main kam se kam kitni sorce code ki lines hongi ? dosto ye lakhs lines main bhi ho sakti hain. kya ek programmer itni lines likh sakta hai ya itna bada software bana sakta hai ? dosto vo bna to sakta hai lekin usko ye karne main bohut time lag jayega. isliye dosto aksar dekha jata hai ki ek software ko bahut sare programmer milkar banate hain.


https://mkbloggers.blogspot.in



Dosto jra sochiye ki jab bhi programmers ka code ek saath execute kiya jayega to ye possibillity hoti hai ki kinhi 2 programmers ne class ya interface ka name same rakh diya ho. dosto agar aisa huya to aisi situation main program error show karega. ab dosto is problem se bachne ke liye java ek mechanism provide karti hai jise package kehte hain.

Friends har programmer apna sara code ek alag package main rakhta hai. dosto aisa karne se agar koi programmer classes ya interfaces ka  name same bhi rakh dete hain tab bhi humare program main error nahi aati hai.

Dosto Packages ko use karne se pehle aapko ye samajhna jaruri hai ki ye kaam kaise karte hain. dosto jis trah hum ek class main method or variable create karte hain or agar vo kisi dusri class ke same name wale hote hain to bhi program main koi error nahi aati hai. dosto usi trah different different packages main hone ki vajah se same name wali classes koi error generate nahi karti hai.


Features of packages

  • Friends packages ki help se hum java main classes or interfaces ko easily maintain kar sakte hain. packages ki help se hum different different category ki classes ko different different packages main maintain kar sakte hain. dosto aisa karne se programmer ki productivity badhti hai.
  • Friends Java Packages humari classes or interfaces ko access protection provide karte hain. agar package main class create karte time humne koi access modifier use nahi kiya hai to us class ko dusre packages ki classes access nahi kar sakti hain. kyunki us class par package private modifier apply ho jata hai.



Creating Java Packages

Friends packages create karne ke liye hum package keyword use karte hain. dosto is keyword ke aage hum package ka unique name likhte hain.

package ourPackage;

Friends ye humare file ki sabse first line honi chahiye. iske baad hum jitini bhi classes or interfaces create karenge to vo sabhi us package main include hoti jati hain. dosto agar humari classes jinko hum ek package main add karna chahte hain to vo sabhi alag alag files main hain to sabko ek file main combine karne ki jarurat hoti hai. dosto bas hume sabhi files main top par ye statement likhna hai to sabhi classes bhi usi package main include ho jayengi.


Using Java Packages

Friends agar koi dusra programmer humare package ki kisi class ko use karna chahta hai to use humara package import karna padega.

import ourPackage;

Friends Package ko import karne ke baad vo sabhi classes ko use kar sakta hai. dosto isi trah vo dusre programmer ke package ko bhi import kar sakta hai or uski classes ko bhi use kar sakta hai.

Friends iske alawa hum (.) operator laga kar bhi kisi class ko directly access kar sakte hain. ise package member access kehte hain. aisi situation main hum sirf usi class ko access kar pate hain.


Import newPackage.ourClass


Some Common Java Packages

Friends java main ek main package hota hai jise API package bolte hain. dosto is package main humare alag alag kaam ke liye dusre packages hote hain jinhe hum program banate time import karke use karte hain. jaise ki IO package or AWT package etc.

Dosto ab hum kuch aise hi common or most use hone wale packages ke bare main janenge :-

java.language
Dosto is package main language support classes hoti hain. ye vo classes hoti hain jo java compiler self use karta hai isliye ye classes bahut hi important hoti hain.

java.io
Friends ye package input output support classes provide karta hai ye data ke input or output ke liye facility provide karta hain.

java.util
Friends ye package language utility classes provide karta hai jaise ki vector, hashtable etc..

java.AWT
Dosto is package main graphical use interface implement karne ke liye classes hoti hain.

java.net
Friends Ye package networking ke liye classes provide karta hai isme server se connection establish karne ke liye classes hoti hain.

java.applet
Dosto ye package applet create karne or implement karne ke liye classes provide karta hai.

Sub Packages
Dosto jab hum kisi package ke under ek or package create karte hain to under wala package sub package kehlata hai. friends ab tak classes ko categories karne ki baat batayi hai lekin hum sub packages ki help se packages ko bhi categories kar sakte hain.



Final Words

To dosto ye thi humari aaj ki post jisme humne Java Packages ke bare main seekha. friends agar aapko humari ye post pasand aayi ho to comment karke jarur bataye aap is post par hume comments karke apne suggestions bhi de sakte hain or dosto post ko share jarur kare Thanks..



Please Share This Post

Team Tips Arena

No comments:

Post a Comment