SlideShare a Scribd company logo
1 of 9
Nibble MATRIX Summer Training First day.
Environment Setting
Select Start -> Computer -> System Properties -> Advanced system settings ->
Advanced-> environment variable-> system variable ->path
Variable name= Path
Variable value= ; C:Program FilesJavajdk1.6.0_02bin;.
Ok and OK
Select
Java:
java is an object oriented, internet programming languge .
Its main feature is
1-plateform independent on machine
2- security
there are two tools which is for compliling and running java programs
javac - it is compiler which converst java source code to byte code ie.class file. This byte
code is standard for all platforms, machines or operating systems.
java - this is interpreter. this interprets the .class file based on a particular platform and
excutes them.e jvm -> java virtual machine comes into play. jvm for windows will be
different from jvm for solarais or linux . but all the jvm take the same byte code and
executes them in that platform.
Source code -> javac ->Universal byte code
Universal byte ->jvm/java -> execute them on a particular machine.
Syntex Of Defining Class:
Class Identifier
{
Member definition
}
/// First Pgm:-
public class Add {
void Addition(int a ,int b)
{
int c=a+b;
System.out.println("Sum of 2 number="+c);
}
public static void main(String[] args) {
Add obj=new Add();
obj.Addition(10, 20);
}
}
Steps to
//Run java pgm
// javac Add.java
Java Add
Naming Convension in Java:
Class: 1st letter of each world of class is capital
example: Welcome , ArrayIndexOutOfBoundException
Method: ist letter of each word except first world is capital
Example:- nextInt() , nextLine()
Keywords:-
Keywords are reserved identifiers that are predefined in the language and cannot
be used to denote other entities. All the keywords are in lowercase, and incorrect
usage results in compilation errors.
Identifiers :-
In Java an identifier is composed of a sequence of characters, where each character can be
either a letter, a digit, a connecting punctuation (such as underscore _), or any currency symbol
(such as $, ¢, ¥, or £). Identifiers can be used to denote classes, methods,
variables, and labels
Examples of Legal Identifiers:
number, Number, sum_$, bingo, $$_100,
Examples of Illegal Identifiers:
48chevy, all@hands, grand-sum
Lifetime of Variables:- is, the time a variable is accessible during execution, its
determined by the context in which it is declared
There are context of variable-
Instance variables :- members of a class and created for each object of the class
Static variables :- also members of a class, but not created for any object of the class and,
therefore, belong only to the class
Local variables :- declared in methods and in blocks and created for each execution of the
method or block
Default Values :-
Data Type Default Value Default data type
boolean false
char 'u0000'
Integer (byte, short, int, long) 0L for long, 0 for others Int
and can be specified by long by
appending the suffix (L or l)
Floating-point (float, double) 0.0F or 0.0D double but it can be explicitly
designated by appending the suffix
D (or d) to the value
Reference types null
type casting - to convert one cast to another cast
implicit type casting : auto - lower to higher
Example: byte b = 100;
int a = b; - valid
explicit type casting: user - higher to lower/ String to any.
int a = 200;
byte b = a; - error , need to explicit type casting
byte b = (byte)a;
Exmple:
public class Test {
void disp(){
int a = 300;
byte b = (byte)a;
System.out.println("value of b="+b);
}
public static void main(String[] args) {
Test obj=new Test();
obj.disp();
}
}
Ans= value of b=44
data types in java -
Data Byte
byte 1
short 2
int 4
long 8
float 4
double 8
char 2
boolean true / false
String to int
i- int a = Integer.parseInt(aa[0]);
ii- int a = Integer.valueOf(aa[0]).intValue();
String to float
i- float a = Float.parseFloat(aa[0]);
ii- float a = Float.valueOf(aa[0]).floatValue();
String to double
i- double a = Double.parseDouble(aa[0]);
ii- double a = Double.valueOf(aa[0]).doubleValue();
String to long
i- long a = Long.parseLong(aa[0]);
ii- long a = Long.valueOf(aa[0]).longValue();
Object creation in C++
int a; - var declare
Classname objname ;
ex -
C1 o; - default or no argument passing Constructor calling.
in java
Classname objname = new ClassConstructor();
ex -
C1 o = new C1(); - default or no argument passing Constructor
calling.
working with objects in java
Object var - before memory allocation
ClassName objname;
ex -
C1 o; - o is a kind of object var
Instance var - after memory allocation
objname = new ClassConstructor();
ex -
o = new C1(); - now o is is a kind of instance var.
a = 10; - now a is a initialize var
int a = 100; - declare + initialize
C1 o = new C1(); - object + instance
Ref object var - when one object hold the ref of another object
C1 o = new C1();
C1 n = o; - n hold the ref of o object.
new - operator , it is for -
* call the Constructor
* allocate memory for Object
* return ref of class for Object.
C1 o = new C1();
o.disp(); - C1 class disp.

More Related Content

What's hot

What's hot (20)

Lecture 7 arrays
Lecture   7 arraysLecture   7 arrays
Lecture 7 arrays
 
C# programming
C# programming C# programming
C# programming
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
Java Foundations: Methods
Java Foundations: MethodsJava Foundations: Methods
Java Foundations: Methods
 
Introduction to c ++ part -2
Introduction to c ++   part -2Introduction to c ++   part -2
Introduction to c ++ part -2
 
Operators
OperatorsOperators
Operators
 
Java Programs
Java ProgramsJava Programs
Java Programs
 
Built in classes in java
Built in classes in javaBuilt in classes in java
Built in classes in java
 
Java ppt Gandhi Ravi (gandhiri@gmail.com)
Java ppt  Gandhi Ravi  (gandhiri@gmail.com)Java ppt  Gandhi Ravi  (gandhiri@gmail.com)
Java ppt Gandhi Ravi (gandhiri@gmail.com)
 
Advanced Python : Static and Class Methods
Advanced Python : Static and Class Methods Advanced Python : Static and Class Methods
Advanced Python : Static and Class Methods
 
Core java concepts
Core java concepts Core java concepts
Core java concepts
 
Python programming : Abstract classes interfaces
Python programming : Abstract classes interfacesPython programming : Abstract classes interfaces
Python programming : Abstract classes interfaces
 
Java Basic day-2
Java Basic day-2Java Basic day-2
Java Basic day-2
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)
 
Java Foundations: Objects and Classes
Java Foundations: Objects and ClassesJava Foundations: Objects and Classes
Java Foundations: Objects and Classes
 
Quick python reference
Quick python referenceQuick python reference
Quick python reference
 
Python unit 3 m.sc cs
Python unit 3 m.sc csPython unit 3 m.sc cs
Python unit 3 m.sc cs
 
Interface
InterfaceInterface
Interface
 
11. java methods
11. java methods11. java methods
11. java methods
 

Viewers also liked

Unidades de medida
Unidades de medidaUnidades de medida
Unidades de medidachica23
 
Living past chapter 4 government by ferry tanoto
Living past chapter 4 government by ferry tanotoLiving past chapter 4 government by ferry tanoto
Living past chapter 4 government by ferry tanotoTNT COURSE
 
Database Oracle Basic
Database Oracle BasicDatabase Oracle Basic
Database Oracle BasicKamlesh Singh
 
Social networks analisys - github API
Social networks analisys - github APISocial networks analisys - github API
Social networks analisys - github APIbaturin
 
Gretapeyran 2010 11-esercizio4
Gretapeyran 2010 11-esercizio4Gretapeyran 2010 11-esercizio4
Gretapeyran 2010 11-esercizio4gretaperi
 
Gretapeyran 2010 11-esercizio4
Gretapeyran 2010 11-esercizio4Gretapeyran 2010 11-esercizio4
Gretapeyran 2010 11-esercizio4gretaperi
 
Social networks analisys - github API
Social networks analisys - github APISocial networks analisys - github API
Social networks analisys - github APIbaturin
 
Smartphone Research - Nov 2010
Smartphone Research - Nov 2010Smartphone Research - Nov 2010
Smartphone Research - Nov 20101GoldenSquare
 
Tcnicasdedibujoypintura2 110502060246-phpapp01
Tcnicasdedibujoypintura2 110502060246-phpapp01Tcnicasdedibujoypintura2 110502060246-phpapp01
Tcnicasdedibujoypintura2 110502060246-phpapp01chica23
 

Viewers also liked (13)

Ui vs ux
Ui vs uxUi vs ux
Ui vs ux
 
Unidades de medida
Unidades de medidaUnidades de medida
Unidades de medida
 
Living past chapter 4 government by ferry tanoto
Living past chapter 4 government by ferry tanotoLiving past chapter 4 government by ferry tanoto
Living past chapter 4 government by ferry tanoto
 
Database Oracle Basic
Database Oracle BasicDatabase Oracle Basic
Database Oracle Basic
 
Social networks analisys - github API
Social networks analisys - github APISocial networks analisys - github API
Social networks analisys - github API
 
Powerpoint
PowerpointPowerpoint
Powerpoint
 
Gretapeyran 2010 11-esercizio4
Gretapeyran 2010 11-esercizio4Gretapeyran 2010 11-esercizio4
Gretapeyran 2010 11-esercizio4
 
Gretapeyran 2010 11-esercizio4
Gretapeyran 2010 11-esercizio4Gretapeyran 2010 11-esercizio4
Gretapeyran 2010 11-esercizio4
 
Social networks analisys - github API
Social networks analisys - github APISocial networks analisys - github API
Social networks analisys - github API
 
Jvm
JvmJvm
Jvm
 
Smartphone Research - Nov 2010
Smartphone Research - Nov 2010Smartphone Research - Nov 2010
Smartphone Research - Nov 2010
 
Tcnicasdedibujoypintura2 110502060246-phpapp01
Tcnicasdedibujoypintura2 110502060246-phpapp01Tcnicasdedibujoypintura2 110502060246-phpapp01
Tcnicasdedibujoypintura2 110502060246-phpapp01
 
Oops Concept Java
Oops Concept JavaOops Concept Java
Oops Concept Java
 

Similar to Java Basic day-1

java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming NeedsRaja Sekhar
 
Identifiers, keywords and types
Identifiers, keywords and typesIdentifiers, keywords and types
Identifiers, keywords and typesDaman Toor
 
OOP-java-variables.pptx
OOP-java-variables.pptxOOP-java-variables.pptx
OOP-java-variables.pptxssuserb1a18d
 
Learning Java 1 – Introduction
Learning Java 1 – IntroductionLearning Java 1 – Introduction
Learning Java 1 – Introductioncaswenson
 
Lecture2_MCS4_Evening.pptx
Lecture2_MCS4_Evening.pptxLecture2_MCS4_Evening.pptx
Lecture2_MCS4_Evening.pptxSaqlainYaqub1
 
object oriented programming java lectures
object oriented programming java lecturesobject oriented programming java lectures
object oriented programming java lecturesMSohaib24
 
Lecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptLecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptmanish kumar
 
Stream Based Input Output
Stream Based Input OutputStream Based Input Output
Stream Based Input OutputBharat17485
 

Similar to Java Basic day-1 (20)

java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming Needs
 
Identifiers, keywords and types
Identifiers, keywords and typesIdentifiers, keywords and types
Identifiers, keywords and types
 
OOP-java-variables.pptx
OOP-java-variables.pptxOOP-java-variables.pptx
OOP-java-variables.pptx
 
Learning Java 1 – Introduction
Learning Java 1 – IntroductionLearning Java 1 – Introduction
Learning Java 1 – Introduction
 
Java Language fundamental
Java Language fundamentalJava Language fundamental
Java Language fundamental
 
Lecture2_MCS4_Evening.pptx
Lecture2_MCS4_Evening.pptxLecture2_MCS4_Evening.pptx
Lecture2_MCS4_Evening.pptx
 
Variables and Data Types
Variables and Data TypesVariables and Data Types
Variables and Data Types
 
Lecture 2 java.pdf
Lecture 2 java.pdfLecture 2 java.pdf
Lecture 2 java.pdf
 
Java
JavaJava
Java
 
object oriented programming java lectures
object oriented programming java lecturesobject oriented programming java lectures
object oriented programming java lectures
 
Java tut1
Java tut1Java tut1
Java tut1
 
Tutorial java
Tutorial javaTutorial java
Tutorial java
 
Java Tut1
Java Tut1Java Tut1
Java Tut1
 
Java Tutorial
Java TutorialJava Tutorial
Java Tutorial
 
Java q ref 2018
Java q ref 2018Java q ref 2018
Java q ref 2018
 
Lecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptLecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops concept
 
Java Unit 2(Part 1)
Java Unit 2(Part 1)Java Unit 2(Part 1)
Java Unit 2(Part 1)
 
Basic_Java_02.pptx
Basic_Java_02.pptxBasic_Java_02.pptx
Basic_Java_02.pptx
 
Stream Based Input Output
Stream Based Input OutputStream Based Input Output
Stream Based Input Output
 
First fare 2010 java-introduction
First fare 2010 java-introductionFirst fare 2010 java-introduction
First fare 2010 java-introduction
 

Recently uploaded

Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Recently uploaded (20)

Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Java Basic day-1

  • 1. Nibble MATRIX Summer Training First day. Environment Setting Select Start -> Computer -> System Properties -> Advanced system settings -> Advanced-> environment variable-> system variable ->path Variable name= Path Variable value= ; C:Program FilesJavajdk1.6.0_02bin;. Ok and OK Select
  • 2. Java: java is an object oriented, internet programming languge . Its main feature is 1-plateform independent on machine 2- security there are two tools which is for compliling and running java programs javac - it is compiler which converst java source code to byte code ie.class file. This byte code is standard for all platforms, machines or operating systems. java - this is interpreter. this interprets the .class file based on a particular platform and excutes them.e jvm -> java virtual machine comes into play. jvm for windows will be different from jvm for solarais or linux . but all the jvm take the same byte code and executes them in that platform. Source code -> javac ->Universal byte code Universal byte ->jvm/java -> execute them on a particular machine. Syntex Of Defining Class: Class Identifier { Member definition }
  • 3. /// First Pgm:- public class Add { void Addition(int a ,int b) { int c=a+b; System.out.println("Sum of 2 number="+c); } public static void main(String[] args) { Add obj=new Add(); obj.Addition(10, 20); } } Steps to //Run java pgm // javac Add.java Java Add Naming Convension in Java: Class: 1st letter of each world of class is capital example: Welcome , ArrayIndexOutOfBoundException Method: ist letter of each word except first world is capital Example:- nextInt() , nextLine()
  • 4. Keywords:- Keywords are reserved identifiers that are predefined in the language and cannot be used to denote other entities. All the keywords are in lowercase, and incorrect usage results in compilation errors. Identifiers :- In Java an identifier is composed of a sequence of characters, where each character can be either a letter, a digit, a connecting punctuation (such as underscore _), or any currency symbol (such as $, ¢, ¥, or £). Identifiers can be used to denote classes, methods, variables, and labels Examples of Legal Identifiers: number, Number, sum_$, bingo, $$_100, Examples of Illegal Identifiers: 48chevy, all@hands, grand-sum
  • 5.
  • 6. Lifetime of Variables:- is, the time a variable is accessible during execution, its determined by the context in which it is declared There are context of variable- Instance variables :- members of a class and created for each object of the class Static variables :- also members of a class, but not created for any object of the class and, therefore, belong only to the class Local variables :- declared in methods and in blocks and created for each execution of the method or block Default Values :- Data Type Default Value Default data type boolean false char 'u0000' Integer (byte, short, int, long) 0L for long, 0 for others Int and can be specified by long by appending the suffix (L or l) Floating-point (float, double) 0.0F or 0.0D double but it can be explicitly designated by appending the suffix D (or d) to the value Reference types null
  • 7. type casting - to convert one cast to another cast implicit type casting : auto - lower to higher Example: byte b = 100; int a = b; - valid explicit type casting: user - higher to lower/ String to any. int a = 200; byte b = a; - error , need to explicit type casting byte b = (byte)a; Exmple: public class Test { void disp(){ int a = 300; byte b = (byte)a; System.out.println("value of b="+b); } public static void main(String[] args) { Test obj=new Test(); obj.disp(); } } Ans= value of b=44 data types in java - Data Byte byte 1 short 2 int 4 long 8 float 4 double 8 char 2 boolean true / false
  • 8. String to int i- int a = Integer.parseInt(aa[0]); ii- int a = Integer.valueOf(aa[0]).intValue(); String to float i- float a = Float.parseFloat(aa[0]); ii- float a = Float.valueOf(aa[0]).floatValue(); String to double i- double a = Double.parseDouble(aa[0]); ii- double a = Double.valueOf(aa[0]).doubleValue(); String to long i- long a = Long.parseLong(aa[0]); ii- long a = Long.valueOf(aa[0]).longValue(); Object creation in C++ int a; - var declare Classname objname ; ex - C1 o; - default or no argument passing Constructor calling. in java Classname objname = new ClassConstructor(); ex - C1 o = new C1(); - default or no argument passing Constructor calling. working with objects in java Object var - before memory allocation ClassName objname; ex - C1 o; - o is a kind of object var
  • 9. Instance var - after memory allocation objname = new ClassConstructor(); ex - o = new C1(); - now o is is a kind of instance var. a = 10; - now a is a initialize var int a = 100; - declare + initialize C1 o = new C1(); - object + instance Ref object var - when one object hold the ref of another object C1 o = new C1(); C1 n = o; - n hold the ref of o object. new - operator , it is for - * call the Constructor * allocate memory for Object * return ref of class for Object. C1 o = new C1(); o.disp(); - C1 class disp.