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 6 in Selenium by anonymous
• 130 points
97 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 by Karan
• 19,570 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
• 27,950 points
4,228 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 22, 2019 in Selenium by Abha
• 27,950 points
344 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 13, 2018 in Selenium by king_kenny
• 3,710 points
178 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 27, 2018 in Selenium by Meci Matt
• 9,460 points
4,442 views
0 votes
2 answers
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
235 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 in Selenium by Karan
• 19,570 points
2,895 views