SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Common Pitfalls
1. Not specifying columns in your select statement
(select *)
.
.
StringBuffer queryString = new StringBuffer();
queryString.append("SELECT DISTINCT o.name, o.code, o.price, d.discount “);
queryString.append("FROM com.exist.model.Order as o, “);
queryString.append("com.exist.model.Discounts as d “);
.
.
.
Session session = sessionFactory.getCurrentSession();
Query selectQuery = session.createQuery(queryString.toString());
List<Order> orders= selectQuery.list();
.
.
.
List<OrderTo> orderTo = new ArrayList<OrderTo>();
...
for(Order order:orders){
OrderTo oto = new OrderTo
oto.setName(order.getName());
.
.
.
orderTo.add(oto);
}
.
.
.
2. Select and Transfer
.
.
.
StringBuffer queryString = new StringBuffer();
queryString.append("SELECT DISTINCT new com.exist.to.OrdersTO ");
queryString.append("(o.name, o.code, o.price, d.discount) ");
queryString.append("FROM com.exist.model.Orders as o, ");
queryString.append("com.exist.model.Discounts as d “);
.
.
.
Session session = sessionFactory.getCurrentSession();
Query selectQuery = session.createQuery(queryString.toString());
.
.
.
List<OrdersTO> data = selectQuery.list();
3. Not delegating computations
.
.
.
double bills = someService.getBills(referenceNo);
double payments = someService.getPayments(referenceNo)
double due = bills - payments;
.
.
.
public class Computations {
private SomeService someService;
private double bills;
private double payments;
private double due;
public Computations(SomeService someService, String reference) {
bills = someService.getBills(referenceNo);
payments = someService.getPayments(referenceNo)
due = bills - payments;
}
... <getters of bills, payments and due>
}
.
.
.
Computations computations = new Computations(someService, referenceNo);
double bills = computations.getBills();
double payments = computations.getPayments();
double due = computations.getDue();
.
.
.
4. equals String literal
variable.equals(“String Literal”);
“String literal”.equals(variable);
5. Computing using double or
Double
double minuend = 1.1d;
double subtrahend = 1.0d;
double difference = minuend – subtrahend;
Or
Double minuend = 1.1d;
Double subtrahend = 1.0d;
Double difference = minuend.doubleValue() – subtrahend.doubleValue();
BigDecimal minuend = new BigDecimal(1.1).setScale(2, RoundingMode.HALF_EVEN);
BigDecimal subtrahend = 1.0d;
BigDecimal difference = minuend.subtract(subtrahend);
6. using objects in if
If (object.getBooleanProperty()) {
...
}
if (object!=null && object.getBooleanProperty()) {
...
}
Or
if (object!=null && object.getNumericProperty()>0) {
...
}
Thanks!

Weitere ähnliche Inhalte

Was ist angesagt?

Two scoopsofdjango common patterns for forms
Two scoopsofdjango   common patterns for formsTwo scoopsofdjango   common patterns for forms
Two scoopsofdjango common patterns for forms
Shih-yi Wei
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
Darwin Durand
 

Was ist angesagt? (13)

Two scoopsofdjango common patterns for forms
Two scoopsofdjango   common patterns for formsTwo scoopsofdjango   common patterns for forms
Two scoopsofdjango common patterns for forms
 
Two scoopsofdjango ch16 dealing with the user model
Two scoopsofdjango ch16   dealing with the user modelTwo scoopsofdjango ch16   dealing with the user model
Two scoopsofdjango ch16 dealing with the user model
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
 
Specs2
Specs2Specs2
Specs2
 
The Ring programming language version 1.5.4 book - Part 20 of 185
The Ring programming language version 1.5.4 book - Part 20 of 185The Ring programming language version 1.5.4 book - Part 20 of 185
The Ring programming language version 1.5.4 book - Part 20 of 185
 
Data Structure
Data StructureData Structure
Data Structure
 
Analyzing Functional Programs
Analyzing Functional ProgramsAnalyzing Functional Programs
Analyzing Functional Programs
 
Validation
ValidationValidation
Validation
 
Sql
SqlSql
Sql
 
Array imp of list
Array imp of listArray imp of list
Array imp of list
 
Sql
SqlSql
Sql
 
The Ring programming language version 1.5.4 book - Part 27 of 185
The Ring programming language version 1.5.4 book - Part 27 of 185The Ring programming language version 1.5.4 book - Part 27 of 185
The Ring programming language version 1.5.4 book - Part 27 of 185
 
Scala on Your Phone
Scala on Your PhoneScala on Your Phone
Scala on Your Phone
 

Andere mochten auch

Bc 403(Harman S. Gahir)
Bc 403(Harman S. Gahir)Bc 403(Harman S. Gahir)
Bc 403(Harman S. Gahir)
Harman Gahir
 
MoZeus Worldwide 2012
MoZeus Worldwide 2012MoZeus Worldwide 2012
MoZeus Worldwide 2012
slubey
 
Prepositions workshop
Prepositions workshopPrepositions workshop
Prepositions workshop
darkcrow08
 
The Ideal Shopping Cart + Streamlining The Checkout Process
The Ideal Shopping Cart + Streamlining The Checkout ProcessThe Ideal Shopping Cart + Streamlining The Checkout Process
The Ideal Shopping Cart + Streamlining The Checkout Process
GoECart
 
Pavasarisveneranda
PavasarisvenerandaPavasarisveneranda
Pavasarisveneranda
Parlielupe
 
Serial Entrepreneur Series - All Rights Reserved, 2012
Serial Entrepreneur Series - All Rights Reserved, 2012Serial Entrepreneur Series - All Rights Reserved, 2012
Serial Entrepreneur Series - All Rights Reserved, 2012
Philogic
 

Andere mochten auch (20)

2010 NYC Presentation
2010 NYC Presentation2010 NYC Presentation
2010 NYC Presentation
 
Bc 403(Harman S. Gahir)
Bc 403(Harman S. Gahir)Bc 403(Harman S. Gahir)
Bc 403(Harman S. Gahir)
 
Wire Checklist
Wire ChecklistWire Checklist
Wire Checklist
 
Wistner
WistnerWistner
Wistner
 
MoZeus Worldwide 2012
MoZeus Worldwide 2012MoZeus Worldwide 2012
MoZeus Worldwide 2012
 
2010 q3 google_earnings_slides
2010 q3 google_earnings_slides2010 q3 google_earnings_slides
2010 q3 google_earnings_slides
 
Prepositions workshop
Prepositions workshopPrepositions workshop
Prepositions workshop
 
The Ideal Shopping Cart + Streamlining The Checkout Process
The Ideal Shopping Cart + Streamlining The Checkout ProcessThe Ideal Shopping Cart + Streamlining The Checkout Process
The Ideal Shopping Cart + Streamlining The Checkout Process
 
Numeros
NumerosNumeros
Numeros
 
Rutinas 2
Rutinas 2Rutinas 2
Rutinas 2
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
Mgul slide
Mgul slideMgul slide
Mgul slide
 
Let's Code
Let's CodeLet's Code
Let's Code
 
Pavasaris
PavasarisPavasaris
Pavasaris
 
Pavasarisveneranda
PavasarisvenerandaPavasarisveneranda
Pavasarisveneranda
 
Serial Entrepreneur Series - All Rights Reserved, 2012
Serial Entrepreneur Series - All Rights Reserved, 2012Serial Entrepreneur Series - All Rights Reserved, 2012
Serial Entrepreneur Series - All Rights Reserved, 2012
 
How To Make Your Day Last Longer: Time Management in Marketing Projects
How To Make Your Day Last Longer: Time Management in Marketing Projects How To Make Your Day Last Longer: Time Management in Marketing Projects
How To Make Your Day Last Longer: Time Management in Marketing Projects
 
Review 1st period
Review 1st periodReview 1st period
Review 1st period
 
New Arrivals 2010 oct-16-31
New Arrivals 2010 oct-16-31New Arrivals 2010 oct-16-31
New Arrivals 2010 oct-16-31
 
C:\fakepath\going door to-door a look at the numbers
C:\fakepath\going door to-door a look at the numbersC:\fakepath\going door to-door a look at the numbers
C:\fakepath\going door to-door a look at the numbers
 

Ähnlich wie Common Pitfalls Experienced in Java

C# Starter L04-Collections
C# Starter L04-CollectionsC# Starter L04-Collections
C# Starter L04-Collections
Mohammad Shaker
 
Refactoring 메소드 호출의 단순화
Refactoring 메소드 호출의 단순화Refactoring 메소드 호출의 단순화
Refactoring 메소드 호출의 단순화
HyeonSeok Choi
 

Ähnlich wie Common Pitfalls Experienced in Java (20)

The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84
 
The Ring programming language version 1.6 book - Part 46 of 189
The Ring programming language version 1.6 book - Part 46 of 189The Ring programming language version 1.6 book - Part 46 of 189
The Ring programming language version 1.6 book - Part 46 of 189
 
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31
 
The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196
 
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31
 
The Ring programming language version 1.5.2 book - Part 43 of 181
The Ring programming language version 1.5.2 book - Part 43 of 181The Ring programming language version 1.5.2 book - Part 43 of 181
The Ring programming language version 1.5.2 book - Part 43 of 181
 
The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184
 
The Ring programming language version 1.5.3 book - Part 54 of 184
The Ring programming language version 1.5.3 book - Part 54 of 184The Ring programming language version 1.5.3 book - Part 54 of 184
The Ring programming language version 1.5.3 book - Part 54 of 184
 
C# Starter L04-Collections
C# Starter L04-CollectionsC# Starter L04-Collections
C# Starter L04-Collections
 
The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212
 
Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#
 
For Beginners - C#
For Beginners - C#For Beginners - C#
For Beginners - C#
 
string tokenization
string tokenizationstring tokenization
string tokenization
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Trace
 
The Ring programming language version 1.7 book - Part 40 of 196
The Ring programming language version 1.7 book - Part 40 of 196The Ring programming language version 1.7 book - Part 40 of 196
The Ring programming language version 1.7 book - Part 40 of 196
 
The Ring programming language version 1.5.1 book - Part 35 of 180
The Ring programming language version 1.5.1 book - Part 35 of 180The Ring programming language version 1.5.1 book - Part 35 of 180
The Ring programming language version 1.5.1 book - Part 35 of 180
 
The Ring programming language version 1.5.4 book - Part 44 of 185
The Ring programming language version 1.5.4 book - Part 44 of 185The Ring programming language version 1.5.4 book - Part 44 of 185
The Ring programming language version 1.5.4 book - Part 44 of 185
 
Refactoring 메소드 호출의 단순화
Refactoring 메소드 호출의 단순화Refactoring 메소드 호출의 단순화
Refactoring 메소드 호출의 단순화
 

Mehr von Exist

Mehr von Exist (20)

Postgres Powers Digital Transformation in Southeast Asia – Success Stories
Postgres Powers Digital Transformation in Southeast Asia – Success StoriesPostgres Powers Digital Transformation in Southeast Asia – Success Stories
Postgres Powers Digital Transformation in Southeast Asia – Success Stories
 
Understanding Blockchain and Its Business Benefits
Understanding Blockchain and Its Business BenefitsUnderstanding Blockchain and Its Business Benefits
Understanding Blockchain and Its Business Benefits
 
ブロックチェーンのビジネス上の利点を理解する
ブロックチェーンのビジネス上の利点を理解するブロックチェーンのビジネス上の利点を理解する
ブロックチェーンのビジネス上の利点を理解する
 
How to Select the Right Automation Testing Tool
How to Select the Right Automation Testing ToolHow to Select the Right Automation Testing Tool
How to Select the Right Automation Testing Tool
 
Advancing Global Competitiveness Through Digital Transformation and Big Data ...
Advancing Global Competitiveness Through Digital Transformation and Big Data ...Advancing Global Competitiveness Through Digital Transformation and Big Data ...
Advancing Global Competitiveness Through Digital Transformation and Big Data ...
 
Exist Company Profile
Exist Company ProfileExist Company Profile
Exist Company Profile
 
Exist Company Profile (Nihongo)
Exist Company Profile (Nihongo)Exist Company Profile (Nihongo)
Exist Company Profile (Nihongo)
 
DX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図ります
DX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図りますDX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図ります
DX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図ります
 
Anahaw Retail Enterprise Solution
Anahaw Retail Enterprise SolutionAnahaw Retail Enterprise Solution
Anahaw Retail Enterprise Solution
 
Understanding the state of your web application using Apache Kafka, Spark
Understanding the state of your web application using Apache Kafka, SparkUnderstanding the state of your web application using Apache Kafka, Spark
Understanding the state of your web application using Apache Kafka, Spark
 
The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...
The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...
The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...
 
API-Centric Rails Web Apps and Hybrid Mobile App Integration
API-Centric Rails Web Apps and Hybrid Mobile App IntegrationAPI-Centric Rails Web Apps and Hybrid Mobile App Integration
API-Centric Rails Web Apps and Hybrid Mobile App Integration
 
Clinical Analytics for Improving Health Outcomes
Clinical Analytics for Improving Health OutcomesClinical Analytics for Improving Health Outcomes
Clinical Analytics for Improving Health Outcomes
 
Exist Customer Success Stories
Exist Customer Success StoriesExist Customer Success Stories
Exist Customer Success Stories
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js Presentation
 
Selenium RC Using Java and Maven + Maestro Integration
Selenium RC Using Java and Maven + Maestro IntegrationSelenium RC Using Java and Maven + Maestro Integration
Selenium RC Using Java and Maven + Maestro Integration
 
Philippine Digital Strategy
Philippine Digital StrategyPhilippine Digital Strategy
Philippine Digital Strategy
 
Spectrum of IT BPO Services in the Philippines
Spectrum of IT BPO Services in the PhilippinesSpectrum of IT BPO Services in the Philippines
Spectrum of IT BPO Services in the Philippines
 
What's new in Drupal 7
What's new in Drupal 7What's new in Drupal 7
What's new in Drupal 7
 
Digital Life
Digital LifeDigital Life
Digital Life
 

Kürzlich hochgeladen

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Common Pitfalls Experienced in Java

  • 2. 1. Not specifying columns in your select statement (select *)
  • 3. . . StringBuffer queryString = new StringBuffer(); queryString.append("SELECT DISTINCT o.name, o.code, o.price, d.discount “); queryString.append("FROM com.exist.model.Order as o, “); queryString.append("com.exist.model.Discounts as d “); . . . Session session = sessionFactory.getCurrentSession(); Query selectQuery = session.createQuery(queryString.toString()); List<Order> orders= selectQuery.list(); . . . List<OrderTo> orderTo = new ArrayList<OrderTo>(); ... for(Order order:orders){ OrderTo oto = new OrderTo oto.setName(order.getName()); . . . orderTo.add(oto); } . . . 2. Select and Transfer
  • 4. . . . StringBuffer queryString = new StringBuffer(); queryString.append("SELECT DISTINCT new com.exist.to.OrdersTO "); queryString.append("(o.name, o.code, o.price, d.discount) "); queryString.append("FROM com.exist.model.Orders as o, "); queryString.append("com.exist.model.Discounts as d “); . . . Session session = sessionFactory.getCurrentSession(); Query selectQuery = session.createQuery(queryString.toString()); . . . List<OrdersTO> data = selectQuery.list();
  • 5. 3. Not delegating computations . . . double bills = someService.getBills(referenceNo); double payments = someService.getPayments(referenceNo) double due = bills - payments; . . .
  • 6. public class Computations { private SomeService someService; private double bills; private double payments; private double due; public Computations(SomeService someService, String reference) { bills = someService.getBills(referenceNo); payments = someService.getPayments(referenceNo) due = bills - payments; } ... <getters of bills, payments and due> }
  • 7. . . . Computations computations = new Computations(someService, referenceNo); double bills = computations.getBills(); double payments = computations.getPayments(); double due = computations.getDue(); . . .
  • 8. 4. equals String literal variable.equals(“String Literal”);
  • 10. 5. Computing using double or Double double minuend = 1.1d; double subtrahend = 1.0d; double difference = minuend – subtrahend; Or Double minuend = 1.1d; Double subtrahend = 1.0d; Double difference = minuend.doubleValue() – subtrahend.doubleValue();
  • 11. BigDecimal minuend = new BigDecimal(1.1).setScale(2, RoundingMode.HALF_EVEN); BigDecimal subtrahend = 1.0d; BigDecimal difference = minuend.subtract(subtrahend);
  • 12. 6. using objects in if If (object.getBooleanProperty()) { ... }
  • 13. if (object!=null && object.getBooleanProperty()) { ... } Or if (object!=null && object.getNumericProperty()>0) { ... }