SlideShare a Scribd company logo
1 of 8
Download to read offline
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

Control structures in Java
Control structures in JavaControl structures in Java
Control structures in Java
Ravi_Kant_Sahu
 
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
 

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
 

Viewers also liked

Prezentare pentru conferinta Cooperare Teritorială Moldova-Ukraina
Prezentare pentru conferinta Cooperare Teritorială Moldova-UkrainaPrezentare pentru conferinta Cooperare Teritorială Moldova-Ukraina
Prezentare pentru conferinta Cooperare Teritorială Moldova-Ukraina
Anișoara Gonța
 
6 kuruluşlar için pazarlamada, tanıtımda içerikle pazarlama trendi
6 kuruluşlar için pazarlamada, tanıtımda içerikle pazarlama trendi6 kuruluşlar için pazarlamada, tanıtımda içerikle pazarlama trendi
6 kuruluşlar için pazarlamada, tanıtımda içerikle pazarlama trendi
Turkay Dalan
 
nhật kí MYT Huế
nhật kí MYT Huếnhật kí MYT Huế
nhật kí MYT Huế
Hoa Từ Bi
 
BAB 8. Informasi dalam Praktik
BAB 8. Informasi dalam Praktik BAB 8. Informasi dalam Praktik
BAB 8. Informasi dalam Praktik
audi15Ar
 
5 distribuciones de Linux
5 distribuciones de Linux5 distribuciones de Linux
5 distribuciones de Linux
a21939
 
Philippine stock exchange
Philippine stock exchangePhilippine stock exchange
Philippine stock exchange
Joy Delima
 

Viewers also liked (12)

Prezentare pentru conferinta Cooperare Teritorială Moldova-Ukraina
Prezentare pentru conferinta Cooperare Teritorială Moldova-UkrainaPrezentare pentru conferinta Cooperare Teritorială Moldova-Ukraina
Prezentare pentru conferinta Cooperare Teritorială Moldova-Ukraina
 
Can a data infrastructure become relevant to small businesses?
Can a data infrastructure become relevant to small businesses?Can a data infrastructure become relevant to small businesses?
Can a data infrastructure become relevant to small businesses?
 
6 kuruluşlar için pazarlamada, tanıtımda içerikle pazarlama trendi
6 kuruluşlar için pazarlamada, tanıtımda içerikle pazarlama trendi6 kuruluşlar için pazarlamada, tanıtımda içerikle pazarlama trendi
6 kuruluşlar için pazarlamada, tanıtımda içerikle pazarlama trendi
 
Batik katun jackerton - http://www.jackerton.com
Batik katun jackerton - http://www.jackerton.comBatik katun jackerton - http://www.jackerton.com
Batik katun jackerton - http://www.jackerton.com
 
nhật kí MYT Huế
nhật kí MYT Huếnhật kí MYT Huế
nhật kí MYT Huế
 
Emprender en Murcia — «Quiero montar un negocio ¿qué me aconsejas?» es como «...
Emprender en Murcia — «Quiero montar un negocio ¿qué me aconsejas?» es como «...Emprender en Murcia — «Quiero montar un negocio ¿qué me aconsejas?» es como «...
Emprender en Murcia — «Quiero montar un negocio ¿qué me aconsejas?» es como «...
 
BAB 8. Informasi dalam Praktik
BAB 8. Informasi dalam Praktik BAB 8. Informasi dalam Praktik
BAB 8. Informasi dalam Praktik
 
5 distribuciones de Linux
5 distribuciones de Linux5 distribuciones de Linux
5 distribuciones de Linux
 
Bản tin số 8 Vào đời Khởi nghiệp
Bản tin số 8 Vào đời Khởi nghiệp Bản tin số 8 Vào đời Khởi nghiệp
Bản tin số 8 Vào đời Khởi nghiệp
 
ΟΙ ΠΕΡΙΒΑΛΛΟΝΤΙΚΟΙ ΕΛΕΓΧΟΙ ΚΑΙ Η ΤΑΥΤΟΠΟΙΗΣΗ ΤΗΣ ΠΕΡΙΒΑΛΛΟΝΤΙΚΗΣ ΖΗΜΙΑΣ
ΟΙ ΠΕΡΙΒΑΛΛΟΝΤΙΚΟΙ ΕΛΕΓΧΟΙ ΚΑΙ Η ΤΑΥΤΟΠΟΙΗΣΗ ΤΗΣ ΠΕΡΙΒΑΛΛΟΝΤΙΚΗΣ ΖΗΜΙΑΣΟΙ ΠΕΡΙΒΑΛΛΟΝΤΙΚΟΙ ΕΛΕΓΧΟΙ ΚΑΙ Η ΤΑΥΤΟΠΟΙΗΣΗ ΤΗΣ ΠΕΡΙΒΑΛΛΟΝΤΙΚΗΣ ΖΗΜΙΑΣ
ΟΙ ΠΕΡΙΒΑΛΛΟΝΤΙΚΟΙ ΕΛΕΓΧΟΙ ΚΑΙ Η ΤΑΥΤΟΠΟΙΗΣΗ ΤΗΣ ΠΕΡΙΒΑΛΛΟΝΤΙΚΗΣ ΖΗΜΙΑΣ
 
Philippine stock exchange
Philippine stock exchangePhilippine stock exchange
Philippine stock exchange
 
Analyse de l'existant // Etat de l'art // Positionnement
Analyse de l'existant // Etat de l'art // PositionnementAnalyse de l'existant // Etat de l'art // Positionnement
Analyse de l'existant // Etat de l'art // Positionnement
 

Similar to Accessing non static members from the main

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
 
Multi-class Bio-images Classification
Multi-class Bio-images ClassificationMulti-class Bio-images Classification
Multi-class Bio-images Classification
Zhuo Li
 
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

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
 
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
 
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
 
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

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
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)
 
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...
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

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