Themes: Introduce Java. How to run Java code Data type in Java Primitive data types Non – primitive data types Introduce Java



Download 1,63 Mb.
Sana06.07.2022
Hajmi1,63 Mb.
#747002
Bog'liq
JavaCore

Themes:

  • Introduce Java.
  • How to run Java code
  • Data type in Java
  • Primitive data types
  • Non – primitive data types

Introduce Java

Java is a high-level, class-based, object-oriented programming language. Java was developed by James Gosling at Sun Microsystems and released in May 1995. There are 3 main Java platforms: Java SE (standard edition) Java ME (mobile edition) Java EE (enterprise edition). Java 8, 11 and 17 are supported as Long – Term – supported (LTS) versions.

Sun Microsystems

Sun Microsystems (Sun for short) was an American technology company that sold computers, computer components, software, and information technology services. Sun was founded on February 24, 1982, 13 years early java founded.

JAVA SE

It is a Java programming platform. It includes Java programming APIs such as java.lang, java.io, java.net, java.util, java.sql, java.math etc. It includes core topics like OOPsString, Regex, Exception, Inner classes, Multithreading, I/O Stream, Networking, AWT, Swing, Reflection, Collection, etc.

JAVA ME

It is a micro platform that is dedicated to mobile applications.

JAVA EE

It is an enterprise platform that is mainly used to develop web and enterprise applications. It is built on top of the Java SE platform. 

How to run Java code

Java is compiled and interpreted language, because first, Java source code is compiled by JDK, after source code converted to byte code, the Byte code is interpreted by JRE, finally JVM run byte code any OS. Developers said about JAVA WORA ( write one, run anywhere)

(🤦‍♂️ o’zbekchasiga aytgandan: Javada yozilgan code JDK bilan kompilatsiya qilinib, source codedan byte codega o’tkaziladi. So’ng byte kod JRE bilan kompilatsiya qilinadi, kompilatsiya qilinga kod, JVM bilan hohlangan operatsion tizimda run qilinadi. Byte kodga aylangan kodni istalgan joyda run qilish mumkin)


Source code
JDK
(compilation)
Byte code
JRE (interpretion)
JVM
Source code (file name Main.java)
Code is located Main.java
Complition with JDK. javac is JDK’s tool
Main.class is byte code, we can use anywhere it
Byte code (Main.class) is interpreted by JRE, java is JRE’s tool
Then, JVM shows result

Data type

There is 2 data type in Java. They are primitive and non primitive. Primitive includes 8 type. Non primitive is much.

Primitive:

    • boolean
    • char
    • int
    • byte
    • short
    • long
    • float
    • double

public class Main{

public class Main{

public static void main (String[ ] args){

boolean variable_name = true; // bool tipida o’zgaruvchi ochish

char ch = ‘m’; // char tipida o’zgaruvchi ochish

int num = 15; // int tipida o’zgaruvchi ochish

byte num1 = 2; // byte tipida o’zgaruvchi ochish

short num2 = 129; // short tipida o’zgaruvchi ochish

long num2 = 2345L; // long tipida o’zgaruvchi ochish

float num3 = 213.4f; // float tipida o’zgaruvchi ochish

double num4 = 2345675.565d // double tipida o’zgaruvchi ochish

}

}

Non-primitive data type

  • String
  • Array
  • ArrayList
  • LinkedList

String

  • String consist of chars. Char is one character, but String includes much characters.
  • Example:

    char: ‘h’ , ‘1’ , ‘@’ , ‘A’ …

    String: “Salom dunyo” , “hohlagan narsa bo’lishi mumkin”

  • String is class, so it has methods. We can use String’s method.
  • length() -> return string length

    toLowerCase() -> convert capital letter to small letter

Array

  • Arrays are used to store multiple values. Variables stores one value. But array isn’t this. But arrays has elements. If you want to call some element, you should use elements index. Initialize array :
  • elements_type[] arraysName = {element1, element3, element1};
  • elements_type[] arraysName = new elements_type[values] ;

We initialized new array
We gave new value in array element

ArrayList

  • ArrayList is resizable Array. Array is static type, however ArrayList is dynamic type. Size of an array cannot be modified. if you want to add or remove elements to/from an array, you have to create a new one.

LinkedList


Download 1,63 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish