In Excel handling how is it that we call getRow without creating object of XSSFSheet class

+1 vote
How is it that we invoke getRow() and getCell() without creating object of XSSFSheet class. To create an object we use new keyword right but without using new keyword how is it that we can call the non static methods getRow() and getCell ()

Ex:
XSSFWorkbook workbook = new XSSFWorkbook(fs);
XSSFSheet sheet = workbook.getSheetAt(0);
Row row = sheet.getRow(0);
Cell cell = row.getCell(0);

As we can see here we are calling getRow() and getCell() without creating object of XSSFSheet class using new keyword.
Oct 7, 2020 in Selenium by anonymous
• 130 points
173 views

1 answer to this question.

0 votes

There is a concept of method chaining where we get the reference of a class or an interface and with that reference, we can call the methods.

Refer to https://www.geeksforgeeks.org/method-chaining-in-java-with-examples/

answered Oct 7, 2020 by Karan
• 19,620 points
Thank you so much.
Glad that it helped!

Thank you for your contribution to the Edureka Community. Do upvote the answer in case you found it helpful.

Cheers!

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

What is Base class in Selenium and how it works?

Hey Prashant, in Selenium Base class is the main ...READ MORE

answered Jul 18, 2019 in Selenium by Abha
• 28,060 points
7,874 views
0 votes
2 answers

How can we take screenshots of tests in Selenium 2 using C#

Hey, try using following code command to ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,060 points
472 views
0 votes
1 answer

How to select an Object by its class in Selenium?

When it comes to Selenium, XPath will ...READ MORE

answered Apr 14, 2018 in Selenium by king_kenny
• 3,710 points
306 views
0 votes
1 answer

Is it possible for a website to detect that we are using Selenium with ChromeDriver

Selenium tests for pre-defined javascript variables which ...READ MORE

answered Apr 28, 2018 in Selenium by Meci Matt
• 9,460 points
5,024 views
0 votes
2 answers

what is the need of xpath when you have attributes like id ,class,name in selenium?

some of the controls not have id ...READ MORE

answered Sep 4, 2020 in Selenium by Sri
• 3,190 points
909 views
0 votes
1 answer

How to avoid Compound Class name error in Page Object?

Use a CSS selector instead: .country.name CSS selector is ...READ MORE

answered Jul 31, 2018 in Selenium by Meci Matt
• 9,460 points
402 views
0 votes
1 answer
+1 vote
1 answer

How can I automate the process of adding iPhone to cart in Flipkart using Selenium(java),Page Object Model and TestNG? Also validate if product is added and available in cart?

Hey check this https://www.edureka.co/community/47160/automate-purchase-adding-book-cart-flipkart-using-selenium? It deals with a similar ...READ MORE

answered Jan 13, 2020 in Selenium by Karan
• 19,620 points
5,394 views
0 votes
1 answer