This document discusses data types and variables in Java. It explains that there are two types of data types in Java - primitive and non-primitive. Primitive types include numeric types like int and float, and non-primitive types include classes, strings, and arrays. It also describes different types of variables in Java - local, instance, and static variables. The document provides examples of declaring variables and assigning literals. It further explains concepts like casting, immutable strings, StringBuffer/StringBuilder classes, and arrays.
In the Java programming language, the final keyword is used in several different contexts to define an entity that can only be assigned once. Once a final variable has been assigned, it always contains the same value.
Super keyword is a reference variable that is used for refer parent class object. Super keyword is used in java at three level, at variable level, at method level and at constructor level.
In the Java programming language, the final keyword is used in several different contexts to define an entity that can only be assigned once. Once a final variable has been assigned, it always contains the same value.
Super keyword is a reference variable that is used for refer parent class object. Super keyword is used in java at three level, at variable level, at method level and at constructor level.
Java abstract class & abstract methods,Abstract class in java
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
This keyword is a reference variable that refer the current object in java.
This keyword can be used for call current class constructor.
http://www.tutorial4us.com/java/java-this-keyword
Java abstract class & abstract methods,Abstract class in java
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
This keyword is a reference variable that refer the current object in java.
This keyword can be used for call current class constructor.
http://www.tutorial4us.com/java/java-this-keyword
In the given example only one object will be created. Firstly JVM will not fi...Indu32
In the given example only one object will be created. Firstly JVM will not find any string object with the value “Welcome” in the string constant pool, so it will create a new object. After that it will find the string with the value “Welcome” in the pool, it will not create a new object but will return the reference to the same instance. In this article, we will learn about Java Strings.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
2. What are DataTypes?
Data-types means containers.
They specify what kind of data to hold
In java, there are two types of data types
Primitive data types
Non-primitive data types
5. Variables
Variable is name of reserved area allocated in memory.
There are three types of variables in java
local variable
A variable that is declared inside the method is called local variable.
instance variable
A variable that is declared inside the class but outside the method is
called instance variable . It is not declared as static.
static variable
A variable that is declared as static is called static variable. It cannot
be local.
7. Literals
Literals are numbers, characters, and string representations used
in a program.
Numeric Literals
int roll_no=45;
Character literals
char letter = ‘b';
letter = ‘S';
String literals
String message = "HellotWorldn";
8. Casting is required when there is a need to explicitly convert a
value from one type to another.
The general syntax for a cast is:
Examples
Casting
(result_type) value;
float price = 37.53;
int dollars = (int) price; // fractional portion lost
// dollars = 37
char response = 'A';
byte temp =(byte) response; // temp = 65 (ASCII value
// for 'a')
9. Type Casting
Assigning a value of one type to a variable of another
type is known as Type Casting.
In Java, type casting is classified into two types,
Widening Casting(Implicit)
Narrowing Casting(Explicitly done)
10. A widening conversion occurs when a value stored in a
smaller space is converted to a type of a larger space.
There will never be a loss of information
Widening conversions occur automatically when needed.
Widening Conversions
11. A narrowing conversion occurs when a value stored in a larger
space is converted to a type of a smaller space.
Information may be lost
Never occurs automatically. Must be explicitly requested by
the programmer using a cast.
Narrowing Conversions
12. Strings
String is a sequence of characters. In the Java programming
language, strings are objects. There are two types of String
i.e
1. Mutable
2.Immutable
In java, string objects are immutable.
Immutable simply means unmodifiable or unchangeable. It
is immutable because object reference is created.
14. StringBuffer Class
Java StringBuffer class is used to created mutable
(modifiable) string. The StringBuffer class in java is same as
String class except it is mutable i.e. it can be changed.
class StringDemo{
public static void main(String args[]){
StringBuffer sb=new StringBuffer("Hello ");
sb.append("Java");//now original string is changed
System.out.println(sb);//prints Hello Java
}
}
15. StringBuilder Class
Java StringBuilder class is used to create mutable (modifiable) string.
The Java StringBuilder class is same as StringBuffer class except that it
is non-synchronized.
class A{
public static void main(String args[]){
StringBuilder sb=new StringBuilder("Hello ");
sb.append("Java");//now original string is changed
System.out.println(sb);//prints Hello Java
}
}
16. Difference between String and
StringBuffer
String
String class is immutable
String is slow and
consumes more memory
String class overrides the
equals() method of
Object class.
StringBuffer
StringBuffer class is
mutable
StringBuffer is fast and
consumes less memory
StringBuffer class doesn't
override the equals()
method of Object class
17. Difference between String and
StringBuffer conti..
StringBuffer
StringBuffer
is synchronized
StringBuffer is less
efficient than
StringBuilder.
StringBuilder
StringBuilder is non-
synchronized
StringBuilder is more
efficient than
StringBuffer.
18. Arrays
An array is an ordered list of values
0 1 2 3 4 5 6 7 8 9
79 87 94 82 67 98 87 81 74 91
An array of size N is indexed from zero to N-1
rollno
The entire array
has a single name
Each value has a numeric index
This array holds 10 values that are indexed from 0 to 9
19. Array - Syntax
A particular value in an array is referenced using the array
name followed by the index in brackets.
Datatype [ ] variable_name = new datatype[size];
Ex: int [] scores = new int [10];
In JAVA, int is of 4 bytes, total space=4*10=40 bytes.
Space Allocation is based on the datatype used to declare
array.
20. Types of Array
Single Dimensional Array (1 D Array)
Two Dimensional Array (2 D Array)
Multidimensional Array(Arrays of Arrays)
21. Dot Operator
Dot operator is used to access methods and variables
within classes.
It is represented as . (dot)
Example
class Test
{
public int a;
public display()
{
System.out.println(“Hello”);
}
}
public static void main(String args[])
{
Test t=new Test();
t.a=32; //accessing dot
t.display(); //accessing display
}
}