SlideShare ist ein Scribd-Unternehmen logo
1 von 54
Dr Java Workshop – By Satyarth Gaur We will cover the following areas:  - Top 10 mistakes made by Java programmers – How to avoid them    - Core Java- Best Practices – This covers good and bad practices both - How to prepare for Java Interviews and Sun Java Exams
Top Ten Errors Java Programmers Make SATYARTH GAUR [email_address]
Accessing non-static member variables from static methods (such as main) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Contd.. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Mistyping the name of a method when overriding ,[object Object]
Comparison assignment (  = rather than == ) ,[object Object]
Comparing two objects ( == instead of .equals) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Confusion over passing by value, and passing by reference ,[object Object]
Contd.. ,[object Object]
Writing blank exception handlers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Forgetting that Java is zero-indexed ,[object Object]
Example Contd.. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Preventing concurrent access to shared variables by threads ,[object Object]
Contd.. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Capitalization errors ,[object Object],[object Object],[object Object]
Capitalization errors ,[object Object],[object Object],[object Object]
Null pointers ,[object Object],[object Object]
Java  Best Practices Java Fundamentals & Object-Oriented Programming Dr Java Boot Camp – Satyarth Gaur
Bad Practices
Duplicate Code! ,[object Object],[object Object]
Accessible Fields ,[object Object],[object Object],[object Object],[object Object]
Using Magic Numbers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Temporary Fields ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Initializing Strings with “new” ,[object Object],[object Object],[object Object],[object Object]
Using floats and doubles for currency calculations ,[object Object],[object Object],[object Object]
Returning null ,[object Object],[object Object],[object Object],[object Object]
 
 
Subclassing for Functionality ,[object Object],[object Object],[object Object],[object Object],[object Object]
Empty Catch Block ,[object Object]
Using Exceptions Unexceptionally ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Excessive Use of Switches ,[object Object],[object Object]
instanceof ,[object Object],[object Object],[object Object],[object Object],[object Object]
Static Methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
System.exit ,[object Object],[object Object]
Good Practices
Validate Your Parameters ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Create Defensive Copies ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Modify Strings with StringBuilder ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Favor Immutability ,[object Object],[object Object],[object Object]
Prefer  “final” for Variables ,[object Object],[object Object]
Declare Variable Just Before Use ,[object Object]
Initialize Variables Whenever Possible ,[object Object],[object Object]
Follow Code Conventions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Refer to Objects by Interfaces ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Consider Using Enums instead of Constants ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Close Your I/O Streams ,[object Object],[object Object]
Design Close to Domain ,[object Object],[object Object],[object Object],[object Object]
If You Override equals() Override hashcode() ,[object Object],[object Object]
Write Self-Documenting Code ,[object Object],[object Object],[object Object]
Use Javadoc Liberally ,[object Object]
Bubble-Up Exceptions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Best Sites for Java Examples,Code Samples,Tutorials and Interview Preparation ,[object Object],[object Object],[object Object],[object Object]
Contd.. ,[object Object],[object Object],[object Object],[object Object],[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

Hadoop Interview Questions And Answers Part-2 | Big Data Interview Questions ...
Hadoop Interview Questions And Answers Part-2 | Big Data Interview Questions ...Hadoop Interview Questions And Answers Part-2 | Big Data Interview Questions ...
Hadoop Interview Questions And Answers Part-2 | Big Data Interview Questions ...
Simplilearn
 
6 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/26 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/2
Fabio Fumarola
 

Was ist angesagt? (20)

Solr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseSolr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by Case
 
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
FYBSC IT Web Programming Unit V  Advanced PHP and MySQLFYBSC IT Web Programming Unit V  Advanced PHP and MySQL
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
 
1. SQL Basics - Introduction
1. SQL Basics - Introduction1. SQL Basics - Introduction
1. SQL Basics - Introduction
 
Restful web services ppt
Restful web services pptRestful web services ppt
Restful web services ppt
 
Big Data Analytics Lab File
Big Data Analytics Lab FileBig Data Analytics Lab File
Big Data Analytics Lab File
 
Hadoop Interview Questions And Answers Part-2 | Big Data Interview Questions ...
Hadoop Interview Questions And Answers Part-2 | Big Data Interview Questions ...Hadoop Interview Questions And Answers Part-2 | Big Data Interview Questions ...
Hadoop Interview Questions And Answers Part-2 | Big Data Interview Questions ...
 
Data models
Data modelsData models
Data models
 
4.2 PHP Function
4.2 PHP Function4.2 PHP Function
4.2 PHP Function
 
Batch Processing vs Stream Processing Difference
Batch Processing vs Stream Processing DifferenceBatch Processing vs Stream Processing Difference
Batch Processing vs Stream Processing Difference
 
Data Modeling in Looker
Data Modeling in LookerData Modeling in Looker
Data Modeling in Looker
 
Analysis of database tampering
Analysis of database tamperingAnalysis of database tampering
Analysis of database tampering
 
NoSQL and MapReduce
NoSQL and MapReduceNoSQL and MapReduce
NoSQL and MapReduce
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introduction
 
6 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/26 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/2
 
OpenRefine
OpenRefineOpenRefine
OpenRefine
 
Cloud Application Development – The Future is now
Cloud Application Development – The Future is nowCloud Application Development – The Future is now
Cloud Application Development – The Future is now
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
Lect 08 materialized view
Lect 08 materialized viewLect 08 materialized view
Lect 08 materialized view
 

Andere mochten auch (7)

Java 8 DOs and DON'Ts - javaBin Oslo May 2015
Java 8 DOs and DON'Ts - javaBin Oslo May 2015Java 8 DOs and DON'Ts - javaBin Oslo May 2015
Java 8 DOs and DON'Ts - javaBin Oslo May 2015
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Unit 1 Java
Unit 1 JavaUnit 1 Java
Unit 1 Java
 
Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2
 
Unit 3 Java
Unit 3 JavaUnit 3 Java
Unit 3 Java
 
Object oriented techniques
Object oriented techniquesObject oriented techniques
Object oriented techniques
 
Manage Your Mesh
Manage Your MeshManage Your Mesh
Manage Your Mesh
 

Ähnlich wie JAVA Tutorial- Do's and Don'ts of Java programming

Java script final presentation
Java script final presentationJava script final presentation
Java script final presentation
Adhoura Academy
 
The Java Script Programming Language
The  Java Script  Programming  LanguageThe  Java Script  Programming  Language
The Java Script Programming Language
zone
 
Javascript by Yahoo
Javascript by YahooJavascript by Yahoo
Javascript by Yahoo
birbal
 
Introduction to Intermediate Java
Introduction to Intermediate JavaIntroduction to Intermediate Java
Introduction to Intermediate Java
Philip Johnson
 
Using Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingUsing Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit Testing
Mike Clement
 

Ähnlich wie JAVA Tutorial- Do's and Don'ts of Java programming (20)

DotNet programming & Practices
DotNet programming & PracticesDotNet programming & Practices
DotNet programming & Practices
 
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 script final presentation
Java script final presentationJava script final presentation
Java script final presentation
 
Javascript
JavascriptJavascript
Javascript
 
The Java Script Programming Language
The  Java Script  Programming  LanguageThe  Java Script  Programming  Language
The Java Script Programming Language
 
Les origines de Javascript
Les origines de JavascriptLes origines de Javascript
Les origines de Javascript
 
Javascript by Yahoo
Javascript by YahooJavascript by Yahoo
Javascript by Yahoo
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Language
 
Javascript
JavascriptJavascript
Javascript
 
Java New Programming Features
Java New Programming FeaturesJava New Programming Features
Java New Programming Features
 
Introduction to Intermediate Java
Introduction to Intermediate JavaIntroduction to Intermediate Java
Introduction to Intermediate Java
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
 
Java tutorial PPT
Java tutorial  PPTJava tutorial  PPT
Java tutorial PPT
 
Java coding pitfalls
Java coding pitfallsJava coding pitfalls
Java coding pitfalls
 
Java 5 Features
Java 5 FeaturesJava 5 Features
Java 5 Features
 
Using Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingUsing Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit Testing
 
Effective Java - Generics
Effective Java - GenericsEffective Java - Generics
Effective Java - Generics
 

Mehr von Keshav Kumar

Mehr von Keshav Kumar (8)

JAVA Tutorial- Do's and Don'ts of Java programming
JAVA Tutorial- Do's and Don'ts of Java programmingJAVA Tutorial- Do's and Don'ts of Java programming
JAVA Tutorial- Do's and Don'ts of Java programming
 
Sumit goyal, Promoter, PlanForMe.com
Sumit goyal, Promoter, PlanForMe.com Sumit goyal, Promoter, PlanForMe.com
Sumit goyal, Promoter, PlanForMe.com
 
Alok Mittal, Managing Director, Canaan India
Alok Mittal, Managing Director, Canaan IndiaAlok Mittal, Managing Director, Canaan India
Alok Mittal, Managing Director, Canaan India
 
Manish Vij, Co-founder, Quasar, Tyroo and Zoomtra
Manish Vij, Co-founder, Quasar, Tyroo and ZoomtraManish Vij, Co-founder, Quasar, Tyroo and Zoomtra
Manish Vij, Co-founder, Quasar, Tyroo and Zoomtra
 
Pawan Gadia, Vice President, Ferns 'N' Petals
Pawan Gadia, Vice President, Ferns 'N' PetalsPawan Gadia, Vice President, Ferns 'N' Petals
Pawan Gadia, Vice President, Ferns 'N' Petals
 
Manish Pathak, Brand Building
Manish Pathak, Brand BuildingManish Pathak, Brand Building
Manish Pathak, Brand Building
 
Jatin Mahindra, Founder, InternetMafia
Jatin Mahindra, Founder, InternetMafiaJatin Mahindra, Founder, InternetMafia
Jatin Mahindra, Founder, InternetMafia
 
Ankur Dinesh Garg, CMD, Wirefoot India Technology Ltd.
Ankur Dinesh Garg, CMD, Wirefoot India Technology Ltd.Ankur Dinesh Garg, CMD, Wirefoot India Technology Ltd.
Ankur Dinesh Garg, CMD, Wirefoot India Technology Ltd.
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
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...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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...
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

JAVA Tutorial- Do's and Don'ts of Java programming

  • 1. Dr Java Workshop – By Satyarth Gaur We will cover the following areas:  - Top 10 mistakes made by Java programmers – How to avoid them    - Core Java- Best Practices – This covers good and bad practices both - How to prepare for Java Interviews and Sun Java Exams
  • 2. Top Ten Errors Java Programmers Make SATYARTH GAUR [email_address]
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. Java Best Practices Java Fundamentals & Object-Oriented Programming Dr Java Boot Camp – Satyarth Gaur
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.  
  • 28.  
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.