SlideShare a Scribd company logo
Accessing Non-Static Members from the Main:

Summary:
In this presentation we will discuss about the ways of accessing nonstatic members and calling non-static functions from the static main
method which is the entry point of any Java class.

Theory:
• Margin of error is the statistic that represents the magnitude of
sampling error associated with the results of a research that used a
sample for representing the entire population.
•Sampling error occurs by chance we cannot avoid this error because
when we select a sample for representing a population the value of the
sample statistic depends on the elements included in the sample.
Therefore, each sample provides different value of sample statistic.
Therefore, the difference between the value of sample statistic and the
exact population parameter is called sampling error or margin of error.
Higher the margin of error lower is the confidence that the research
result is close to the true population parameter and vice versa.

http://www.tutorsonnet.com/java-programming-homework-help.php

Page 1
Formula:

In general formula for computing confidence interval for a population
parameter is,

C.I= Sample statistic ± Margin of error
Margin of error depends on the confidence level with which we want to
estimate the population parameter, standard deviation of the sample
(population if given) and the sample size.

Width of a confidence interval is given by,
Width = 2 * margin of error
Margin of error = half the width of the confidence interval =
Width/2
Accordingly formula for computing confidence interval is,
C.I= Sample statistic± (width/2)

Problem:
http://www.tutorsonnet.com/java-programming-homework-help.php

Page 2
• Initial entry point of any Java class is a public static method named as
'main'.
• As 'main' is a static method, we cannot call any non-static member
function of a class without creating class object from the 'main' method
body.
•Similarly we cannot access the non-static members of a class without
creating class object from inside the 'main' method.

Solution:

There are two ways to deal with this kind of a problem.
• Make the function or the class member static. Lithe function does not
callaccess the other non-static functionsmembers of the class, then this
is the way we can solve this problem.
• Create an object of a class and use it to call the non-static functions and
to access the non-static members from inside the 'main' method.

http://www.tutorsonnet.com/java-programming-homework-help.php

Page 3
Mistake Example:

public class EvenOdd {
{ boolean isEven(int num) {
return (num%2 == 0); }
public static void main(String args[]) {
int num = 23;
// compiler will give error for this line
if(isEven(num)) {
System.out.println(num + " is an even numbed");
}
}
}

http://www.tutorsonnet.com/java-programming-homework-help.php

Page 4
Solution 1:
public class EvenOdd {
static boolean isEven(int num) {
return (num%2 == 0);
}
public static void main(String args[]) {
int num = 24;
// compiler will not give error for this line as the function is declared as
static
if(isEven(num)) {
System.out.println(num + " is an even number!");
}
}
}

http://www.tutorsonnet.com/java-programming-homework-help.php

Page 5
Solution 2:
public class EvenOdd {
boolean isEven(int num) {
return (num%2 == 0);
}
public static void main(String args[]) {
int num = 24; EvenOdd evenOddObj = new EvenOdd();
// compiler will not give error for this line as we access the function by
creating an object of
// an EvenOdd class.
if(evenOddObj.isEven(num)) {
System.out.println(num + " is an even number!");
}
}
}

http://www.tutorsonnet.com/java-programming-homework-help.php

Page 6
For More Details:
Website: http://www.tutorsonnet.com
Mail Us: sendquestions@tutorsonnet.com
Phone: +91 98803 85500

List of Subjects which we Provide Homework Help:

1 Accounting

9 C

17 JavaScript

2 Finance

10 Visual Basic

18 Shell Scripting

3 Statistics

11 C# (C Sharp)

19 Math

4 Economics

12 Matlab Programming

20 Chemistry

5 Operations

13 Database

21 Physics

6 Marketing

14 ER Diagrams

22 Dissertations

7 Java

15 Oracle

23 Case Study

8 C++

16 Microsoft (MS) Access

24 Project Management

More Related Content

What's hot

Methods intro-1.0
Methods intro-1.0Methods intro-1.0
Methods intro-1.0
BG Java EE Course
 
Attacks on Victim Model! A Defense Strategy
Attacks on Victim Model! A Defense StrategyAttacks on Victim Model! A Defense Strategy
Attacks on Victim Model! A Defense Strategy
Sivaranjanikumar1
 
Aaa ped-19-Recommender Systems: Neighborhood-based Filtering
Aaa ped-19-Recommender Systems: Neighborhood-based FilteringAaa ped-19-Recommender Systems: Neighborhood-based Filtering
Aaa ped-19-Recommender Systems: Neighborhood-based Filtering
AminaRepo
 
An introduction to variable and feature selection
An introduction to variable and feature selectionAn introduction to variable and feature selection
An introduction to variable and feature selection
Marco Meoni
 
Compiler lab final report writing
Compiler lab final report writingCompiler lab final report writing
Compiler lab final report writing
Umme habiba
 
Md04 flow control
Md04 flow controlMd04 flow control
Md04 flow control
Rakesh Madugula
 
Machine Learning Unit 1 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 1 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 1 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 1 Semester 3 MSc IT Part 2 Mumbai University
Madhav Mishra
 
Pi j1.3 operators
Pi j1.3 operatorsPi j1.3 operators
Pi j1.3 operators
mcollison
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
Bhupender Sharma
 
Feature Selection in Machine Learning
Feature Selection in Machine LearningFeature Selection in Machine Learning
Feature Selection in Machine Learning
Upekha Vandebona
 
Collaborative Filtering 2: Item-based CF
Collaborative Filtering 2: Item-based CFCollaborative Filtering 2: Item-based CF
Collaborative Filtering 2: Item-based CF
Yusuke Yamamoto
 
Control structures in Java
Control structures in JavaControl structures in Java
Control structures in Java
Ravi_Kant_Sahu
 
Tweets Classifier
Tweets ClassifierTweets Classifier
Tweets Classifier
Avanti Gupta
 
Irt 1 pl, 2pl, 3pl.pdf
Irt 1 pl, 2pl, 3pl.pdfIrt 1 pl, 2pl, 3pl.pdf
Irt 1 pl, 2pl, 3pl.pdf
Carlo Magno
 
22 Machine Learning Feature Selection
22 Machine Learning Feature Selection22 Machine Learning Feature Selection
22 Machine Learning Feature Selection
Andres Mendez-Vazquez
 
Svm and maximum entropy model for sentiment analysis of tweets
Svm and maximum entropy model for sentiment analysis of tweetsSvm and maximum entropy model for sentiment analysis of tweets
Svm and maximum entropy model for sentiment analysis of tweets
S M Raju
 
SE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignSE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and Design
Amr E. Mohamed
 
Item Response Theory
Item Response TheoryItem Response Theory
Item Response Theory
RAHUL BHOJWANI
 
SE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAMSE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAM
Amr E. Mohamed
 

What's hot (19)

Methods intro-1.0
Methods intro-1.0Methods intro-1.0
Methods intro-1.0
 
Attacks on Victim Model! A Defense Strategy
Attacks on Victim Model! A Defense StrategyAttacks on Victim Model! A Defense Strategy
Attacks on Victim Model! A Defense Strategy
 
Aaa ped-19-Recommender Systems: Neighborhood-based Filtering
Aaa ped-19-Recommender Systems: Neighborhood-based FilteringAaa ped-19-Recommender Systems: Neighborhood-based Filtering
Aaa ped-19-Recommender Systems: Neighborhood-based Filtering
 
An introduction to variable and feature selection
An introduction to variable and feature selectionAn introduction to variable and feature selection
An introduction to variable and feature selection
 
Compiler lab final report writing
Compiler lab final report writingCompiler lab final report writing
Compiler lab final report writing
 
Md04 flow control
Md04 flow controlMd04 flow control
Md04 flow control
 
Machine Learning Unit 1 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 1 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 1 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 1 Semester 3 MSc IT Part 2 Mumbai University
 
Pi j1.3 operators
Pi j1.3 operatorsPi j1.3 operators
Pi j1.3 operators
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
 
Feature Selection in Machine Learning
Feature Selection in Machine LearningFeature Selection in Machine Learning
Feature Selection in Machine Learning
 
Collaborative Filtering 2: Item-based CF
Collaborative Filtering 2: Item-based CFCollaborative Filtering 2: Item-based CF
Collaborative Filtering 2: Item-based CF
 
Control structures in Java
Control structures in JavaControl structures in Java
Control structures in Java
 
Tweets Classifier
Tweets ClassifierTweets Classifier
Tweets Classifier
 
Irt 1 pl, 2pl, 3pl.pdf
Irt 1 pl, 2pl, 3pl.pdfIrt 1 pl, 2pl, 3pl.pdf
Irt 1 pl, 2pl, 3pl.pdf
 
22 Machine Learning Feature Selection
22 Machine Learning Feature Selection22 Machine Learning Feature Selection
22 Machine Learning Feature Selection
 
Svm and maximum entropy model for sentiment analysis of tweets
Svm and maximum entropy model for sentiment analysis of tweetsSvm and maximum entropy model for sentiment analysis of tweets
Svm and maximum entropy model for sentiment analysis of tweets
 
SE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignSE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and Design
 
Item Response Theory
Item Response TheoryItem Response Theory
Item Response Theory
 
SE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAMSE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAM
 

Similar to Accessing non static members from the main

CIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in JavaCIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in Java
Hamad Odhabi
 
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examples
bindur87
 
Computer programming 2 Lesson 15
Computer programming 2  Lesson 15Computer programming 2  Lesson 15
Computer programming 2 Lesson 15
MLG College of Learning, Inc
 
Exception handling
Exception handlingException handling
Exception handling
vishal choudhary
 
RapidMiner: Data Mining And Rapid Miner
RapidMiner:  Data Mining And Rapid MinerRapidMiner:  Data Mining And Rapid Miner
RapidMiner: Data Mining And Rapid Miner
Rapidmining Content
 
Nalinee java
Nalinee javaNalinee java
Nalinee java
Nalinee Choudhary
 
Feature extraction for classifying students based on theirac ademic performance
Feature extraction for classifying students based on theirac ademic performanceFeature extraction for classifying students based on theirac ademic performance
Feature extraction for classifying students based on theirac ademic performance
Venkat Projects
 
Chapter 2.4
Chapter 2.4Chapter 2.4
Chapter 2.4
sotlsoc
 
Question 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docxQuestion 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docx
amrit47
 
Testing techniques
Testing techniquesTesting techniques
Testing techniques
RaginiRohatgi
 
CIS 407 STUDY Inspiring Innovation--cis407study.com
CIS 407 STUDY Inspiring Innovation--cis407study.comCIS 407 STUDY Inspiring Innovation--cis407study.com
CIS 407 STUDY Inspiring Innovation--cis407study.com
KeatonJennings91
 
Multi-class Bio-images Classification
Multi-class Bio-images ClassificationMulti-class Bio-images Classification
Multi-class Bio-images Classification
Zhuo Li
 
Intro To C++ - Class 10 - Control Statements: Part 2
Intro To C++ - Class 10 - Control Statements: Part 2Intro To C++ - Class 10 - Control Statements: Part 2
Intro To C++ - Class 10 - Control Statements: Part 2
Blue Elephant Consulting
 
Java method
Java methodJava method
Java method
sunilchute1
 
A Novel Methodology to Implement Optimization Algorithms in Machine Learning
A Novel Methodology to Implement Optimization Algorithms in Machine LearningA Novel Methodology to Implement Optimization Algorithms in Machine Learning
A Novel Methodology to Implement Optimization Algorithms in Machine Learning
Venkata Karthik Gullapalli
 
Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62
Max Kleiner
 
Solutions manual for absolute java 5th edition by walter savitch
Solutions manual for absolute java 5th edition by walter savitchSolutions manual for absolute java 5th edition by walter savitch
Solutions manual for absolute java 5th edition by walter savitch
Albern9271
 
Ifi7184 lesson3
Ifi7184 lesson3Ifi7184 lesson3
Ifi7184 lesson3
Sónia
 
Java method present by showrov ahamed
Java method present by showrov ahamedJava method present by showrov ahamed
Java method present by showrov ahamed
Md Showrov Ahmed
 
Finding latent code errors via machine learning over program ...
Finding latent code errors via machine learning over program ...Finding latent code errors via machine learning over program ...
Finding latent code errors via machine learning over program ...
butest
 

Similar to Accessing non static members from the main (20)

CIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in JavaCIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in Java
 
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examples
 
Computer programming 2 Lesson 15
Computer programming 2  Lesson 15Computer programming 2  Lesson 15
Computer programming 2 Lesson 15
 
Exception handling
Exception handlingException handling
Exception handling
 
RapidMiner: Data Mining And Rapid Miner
RapidMiner:  Data Mining And Rapid MinerRapidMiner:  Data Mining And Rapid Miner
RapidMiner: Data Mining And Rapid Miner
 
Nalinee java
Nalinee javaNalinee java
Nalinee java
 
Feature extraction for classifying students based on theirac ademic performance
Feature extraction for classifying students based on theirac ademic performanceFeature extraction for classifying students based on theirac ademic performance
Feature extraction for classifying students based on theirac ademic performance
 
Chapter 2.4
Chapter 2.4Chapter 2.4
Chapter 2.4
 
Question 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docxQuestion 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docx
 
Testing techniques
Testing techniquesTesting techniques
Testing techniques
 
CIS 407 STUDY Inspiring Innovation--cis407study.com
CIS 407 STUDY Inspiring Innovation--cis407study.comCIS 407 STUDY Inspiring Innovation--cis407study.com
CIS 407 STUDY Inspiring Innovation--cis407study.com
 
Multi-class Bio-images Classification
Multi-class Bio-images ClassificationMulti-class Bio-images Classification
Multi-class Bio-images Classification
 
Intro To C++ - Class 10 - Control Statements: Part 2
Intro To C++ - Class 10 - Control Statements: Part 2Intro To C++ - Class 10 - Control Statements: Part 2
Intro To C++ - Class 10 - Control Statements: Part 2
 
Java method
Java methodJava method
Java method
 
A Novel Methodology to Implement Optimization Algorithms in Machine Learning
A Novel Methodology to Implement Optimization Algorithms in Machine LearningA Novel Methodology to Implement Optimization Algorithms in Machine Learning
A Novel Methodology to Implement Optimization Algorithms in Machine Learning
 
Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62
 
Solutions manual for absolute java 5th edition by walter savitch
Solutions manual for absolute java 5th edition by walter savitchSolutions manual for absolute java 5th edition by walter savitch
Solutions manual for absolute java 5th edition by walter savitch
 
Ifi7184 lesson3
Ifi7184 lesson3Ifi7184 lesson3
Ifi7184 lesson3
 
Java method present by showrov ahamed
Java method present by showrov ahamedJava method present by showrov ahamed
Java method present by showrov ahamed
 
Finding latent code errors via machine learning over program ...
Finding latent code errors via machine learning over program ...Finding latent code errors via machine learning over program ...
Finding latent code errors via machine learning over program ...
 

More from Tutors On Net

Perpetual and periodic inventory method – inventories perpetual inventory method
Perpetual and periodic inventory method – inventories perpetual inventory methodPerpetual and periodic inventory method – inventories perpetual inventory method
Perpetual and periodic inventory method – inventories perpetual inventory method
Tutors On Net
 
Methods of absorption ii - factory overheads distribution prime cost percentage
Methods of absorption ii - factory overheads distribution prime cost percentageMethods of absorption ii - factory overheads distribution prime cost percentage
Methods of absorption ii - factory overheads distribution prime cost percentage
Tutors On Net
 
What are the different modes of fund transfer
What are the different modes of fund transfer What are the different modes of fund transfer
What are the different modes of fund transfer
Tutors On Net
 
Mistakes made with string object in java
Mistakes made with string object in javaMistakes made with string object in java
Mistakes made with string object in java
Tutors On Net
 
Accessing non static members from the main
Accessing non static members from the mainAccessing non static members from the main
Accessing non static members from the main
Tutors On Net
 
Major steps to make successful email marketing more mobile friendly
Major steps to make successful email marketing more mobile friendlyMajor steps to make successful email marketing more mobile friendly
Major steps to make successful email marketing more mobile friendly
Tutors On Net
 
Different fields of accounting
Different fields of accountingDifferent fields of accounting
Different fields of accounting
Tutors On Net
 
Scope of management accounting
Scope of management accountingScope of management accounting
Scope of management accounting
Tutors On Net
 
Product mix decision under capacity constraint cost analysis and decision m...
Product mix decision under capacity constraint   cost analysis and decision m...Product mix decision under capacity constraint   cost analysis and decision m...
Product mix decision under capacity constraint cost analysis and decision m...
Tutors On Net
 
Internal departmental services factory overheads
Internal departmental services  factory overheadsInternal departmental services  factory overheads
Internal departmental services factory overheads
Tutors On Net
 
Wholesale and retail profit at branch branch accounting
Wholesale and retail profit at branch   branch accountingWholesale and retail profit at branch   branch accounting
Wholesale and retail profit at branch branch accounting
Tutors On Net
 
Guidelines and uses of financial statement analysis
Guidelines and uses of financial statement analysisGuidelines and uses of financial statement analysis
Guidelines and uses of financial statement analysis
Tutors On Net
 
Admission of a partner average profit method in valuation of non-purchased ...
Admission of a partner   average profit method in valuation of non-purchased ...Admission of a partner   average profit method in valuation of non-purchased ...
Admission of a partner average profit method in valuation of non-purchased ...
Tutors On Net
 
Coverage ratios analysis of financial statements
Coverage ratios   analysis of financial statementsCoverage ratios   analysis of financial statements
Coverage ratios analysis of financial statements
Tutors On Net
 
Interest of capital of partners appropriation of profit and loss
Interest of capital of partners  appropriation of profit and lossInterest of capital of partners  appropriation of profit and loss
Interest of capital of partners appropriation of profit and loss
Tutors On Net
 
Lending a helping hand
Lending a helping handLending a helping hand
Lending a helping hand
Tutors On Net
 

More from Tutors On Net (16)

Perpetual and periodic inventory method – inventories perpetual inventory method
Perpetual and periodic inventory method – inventories perpetual inventory methodPerpetual and periodic inventory method – inventories perpetual inventory method
Perpetual and periodic inventory method – inventories perpetual inventory method
 
Methods of absorption ii - factory overheads distribution prime cost percentage
Methods of absorption ii - factory overheads distribution prime cost percentageMethods of absorption ii - factory overheads distribution prime cost percentage
Methods of absorption ii - factory overheads distribution prime cost percentage
 
What are the different modes of fund transfer
What are the different modes of fund transfer What are the different modes of fund transfer
What are the different modes of fund transfer
 
Mistakes made with string object in java
Mistakes made with string object in javaMistakes made with string object in java
Mistakes made with string object in java
 
Accessing non static members from the main
Accessing non static members from the mainAccessing non static members from the main
Accessing non static members from the main
 
Major steps to make successful email marketing more mobile friendly
Major steps to make successful email marketing more mobile friendlyMajor steps to make successful email marketing more mobile friendly
Major steps to make successful email marketing more mobile friendly
 
Different fields of accounting
Different fields of accountingDifferent fields of accounting
Different fields of accounting
 
Scope of management accounting
Scope of management accountingScope of management accounting
Scope of management accounting
 
Product mix decision under capacity constraint cost analysis and decision m...
Product mix decision under capacity constraint   cost analysis and decision m...Product mix decision under capacity constraint   cost analysis and decision m...
Product mix decision under capacity constraint cost analysis and decision m...
 
Internal departmental services factory overheads
Internal departmental services  factory overheadsInternal departmental services  factory overheads
Internal departmental services factory overheads
 
Wholesale and retail profit at branch branch accounting
Wholesale and retail profit at branch   branch accountingWholesale and retail profit at branch   branch accounting
Wholesale and retail profit at branch branch accounting
 
Guidelines and uses of financial statement analysis
Guidelines and uses of financial statement analysisGuidelines and uses of financial statement analysis
Guidelines and uses of financial statement analysis
 
Admission of a partner average profit method in valuation of non-purchased ...
Admission of a partner   average profit method in valuation of non-purchased ...Admission of a partner   average profit method in valuation of non-purchased ...
Admission of a partner average profit method in valuation of non-purchased ...
 
Coverage ratios analysis of financial statements
Coverage ratios   analysis of financial statementsCoverage ratios   analysis of financial statements
Coverage ratios analysis of financial statements
 
Interest of capital of partners appropriation of profit and loss
Interest of capital of partners  appropriation of profit and lossInterest of capital of partners  appropriation of profit and loss
Interest of capital of partners appropriation of profit and loss
 
Lending a helping hand
Lending a helping handLending a helping hand
Lending a helping hand
 

Recently uploaded

BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
sayalidalavi006
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 

Recently uploaded (20)

BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 

Accessing non static members from the main

  • 1.
  • 2. Accessing Non-Static Members from the Main: Summary: In this presentation we will discuss about the ways of accessing nonstatic members and calling non-static functions from the static main method which is the entry point of any Java class. Theory: • Margin of error is the statistic that represents the magnitude of sampling error associated with the results of a research that used a sample for representing the entire population. •Sampling error occurs by chance we cannot avoid this error because when we select a sample for representing a population the value of the sample statistic depends on the elements included in the sample. Therefore, each sample provides different value of sample statistic. Therefore, the difference between the value of sample statistic and the exact population parameter is called sampling error or margin of error. Higher the margin of error lower is the confidence that the research result is close to the true population parameter and vice versa. http://www.tutorsonnet.com/java-programming-homework-help.php Page 1
  • 3. Formula: In general formula for computing confidence interval for a population parameter is, C.I= Sample statistic ± Margin of error Margin of error depends on the confidence level with which we want to estimate the population parameter, standard deviation of the sample (population if given) and the sample size. Width of a confidence interval is given by, Width = 2 * margin of error Margin of error = half the width of the confidence interval = Width/2 Accordingly formula for computing confidence interval is, C.I= Sample statistic± (width/2) Problem: http://www.tutorsonnet.com/java-programming-homework-help.php Page 2
  • 4. • Initial entry point of any Java class is a public static method named as 'main'. • As 'main' is a static method, we cannot call any non-static member function of a class without creating class object from the 'main' method body. •Similarly we cannot access the non-static members of a class without creating class object from inside the 'main' method. Solution: There are two ways to deal with this kind of a problem. • Make the function or the class member static. Lithe function does not callaccess the other non-static functionsmembers of the class, then this is the way we can solve this problem. • Create an object of a class and use it to call the non-static functions and to access the non-static members from inside the 'main' method. http://www.tutorsonnet.com/java-programming-homework-help.php Page 3
  • 5. Mistake Example: public class EvenOdd { { boolean isEven(int num) { return (num%2 == 0); } public static void main(String args[]) { int num = 23; // compiler will give error for this line if(isEven(num)) { System.out.println(num + " is an even numbed"); } } } http://www.tutorsonnet.com/java-programming-homework-help.php Page 4
  • 6. Solution 1: public class EvenOdd { static boolean isEven(int num) { return (num%2 == 0); } public static void main(String args[]) { int num = 24; // compiler will not give error for this line as the function is declared as static if(isEven(num)) { System.out.println(num + " is an even number!"); } } } http://www.tutorsonnet.com/java-programming-homework-help.php Page 5
  • 7. Solution 2: public class EvenOdd { boolean isEven(int num) { return (num%2 == 0); } public static void main(String args[]) { int num = 24; EvenOdd evenOddObj = new EvenOdd(); // compiler will not give error for this line as we access the function by creating an object of // an EvenOdd class. if(evenOddObj.isEven(num)) { System.out.println(num + " is an even number!"); } } } http://www.tutorsonnet.com/java-programming-homework-help.php Page 6
  • 8. For More Details: Website: http://www.tutorsonnet.com Mail Us: sendquestions@tutorsonnet.com Phone: +91 98803 85500 List of Subjects which we Provide Homework Help: 1 Accounting 9 C 17 JavaScript 2 Finance 10 Visual Basic 18 Shell Scripting 3 Statistics 11 C# (C Sharp) 19 Math 4 Economics 12 Matlab Programming 20 Chemistry 5 Operations 13 Database 21 Physics 6 Marketing 14 ER Diagrams 22 Dissertations 7 Java 15 Oracle 23 Case Study 8 C++ 16 Microsoft (MS) Access 24 Project Management