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 OOPs, String, 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 } } - 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.
Array ArrayList LinkedList
Do'stlaringiz bilan baham: |