The process of converting from one data type to another data type is
called as type Conversion .
There are two types of type Conversion :
1. Implicit Type Conversion :
2. Explicit Type Conversion :
1.Implicit Type Conversion :
This is the process of converting from one data type to another data type
by the compiler without programmer’s intervention.
Also called as COERCION /Type Promotion because one type of data is automatically promoted from lower to higher capacity of data.
Example :
byte to short to int to long
Oh it means if we are performing operation
with int and long then the output will be long type
and so on
2. Explicit Type Conversion:
This is the process of converting from one data type to another data type
by explicitly specifying the data type in the parenthesis just before the variable or expression. It is also known as type casting.
(Data type) is called cast operator.
int x=20;
System.out.print((double)x);
Output will be in 20.0 as double
double x =7.50;
System.out.print((int)x);
Output will be in 7 as int
Why do use this concept in Java ;
Ans :We can prevent the loss of data while performing an operation that contains miscellaneous data types.
List of primitive data types
byte (number, 1 byte)
short (number, 2 bytes)
int (number, 4 bytes)
long (number, 8 bytes)
float (float number, 4 bytes)
double (float number, 8 bytes)
char (a character, 2 bytes)
boolean (true or false, 1 byte)
Full Forms in Java Programming
1. JITC - Just in Time Compiler
2.JVM - Java Virtual Machine
3. POP - Procedure Oriented Programming
4. OOP - Object Oriented Programming
5. OOPL - Objec Oriented Programming Language
6.OOPS - Object Oriented Programming Structure
7. ASCII - American Standard Code for Information Interchange
8. ISCII - Indian Standard Code for Information Interchange
9. UTF - Unicode Transformation Format
10. UNICODE - Unique, Universal, and Uniform character Encoding
11.HLL - High Level Language
12.MLL - Machine Level Language
13. LLL - Low Level Language
14. MNL- Machine Native Language
15. OODM - Object-Oriented Data Modeling/Methods
16. CDM - Conceptual Data Modeling
17. JDK - Java Development Kit
18. AWT - Abstract Windows Toolkit
19. IDE - Integrated Development Environment
20. API - Application Programming Interface
21. GUI - Graphical User Interface
22.CUI - Command/Character User Interface
23.WORA - Write Once Run Anywhere
24. SQL - Structured Query Language
25. IO - Input Output
Java programs for practice:
1. Write a program to input any sentence and convert the first alphabet into lower case and rest alphabets into uppercase
2. Write a program to create an Array of 10 words and print only those words which are palindrome
3. Write a program to create an Array of 10 words and print the longest word from the Array list
4. Write a program to accept a string and convert the string into upper case and count and display the number of double letter sequences that exist in the string.
Eg- "SHE WAS F*EE*DING THE LI*TT*LE RA*BB*IT WITH AN A*PP*LE"
5. Write a program to create an Array of 10 words and then print only those words which start and end with the same letter
6. Write a program to create an Array of 10 integers and then find the sum of composite and prime numbers separately
7. Write a program to create two integer arrays with size m and n respectively . Then, create another array to merge thr values of the 2 arrays to the 3rd one
8. Write a program to create an Array of 20 integer datatype and print each number along with their factors
9. Write a program to create an Array of 20 words and print only those words which start with vowel and ends with a consonant
10. Write a program to create an Array of 'n' elements that stores the basic salary of 'n' number of employees . Then , count the number of employees who are getting more than the average salary and less than the average salary
11. Write a program to create an Array of 'n' elements and split it into two equal arrays . If the array contains odd no. Of elements, print an appropriate message but if it contains even no.of elements, then split it into 2 different arrays
12. Write a program to create an Array of *n* number of elements to store *n* number of integers then input a particular number to be searched and replace it with another number which is to be input by the user
13. Write a Program to input any sentence and print only those words which contain no vowel
14. Write a program to input any sentence and convert it into upper case and count and display total number of words starting with the letter *A*
15. Write a program to input any sentence and convert it into upper case and display each word in a separate line
16. Write a program to input three different numbers and find and display the middle number
17. Write a program to input a word and create a new word by removing all the vowels and print it
18. Write a program to input any sentence and check if the sentence contains all the alphabets (from A-Z) or not If it contains all the alphabets that print an appropriate msg.
19. Write a program to input any sentence and print the word that contains maximum number of vowels
20. Write a program to input any sentence and reverse each word to their own place
21. Write a program to create an Array of 10 integer elements and print only those elements which are even in even indexes.
More stuff coming soon ☺️