SDET Interview Question and Answers.
Java Interview Question SET-01
Java INterview Question Set-02 ARRAY
Java INterview Questiona Set-03 MAP
Java INterview Question Set-04
In Java, there are three types of variables: local variables, instance variables, and class/static variables. Here's an explanation of each type with examples:
- Local Variables:
These are variables that are declared inside a method, constructor, or block. They are only accessible within the scope of the method, constructor, or block in which they are declared. Local variables must be initialized before they can be used.
These are variables that are declared inside a method, constructor, or block. They are only accessible within the scope of the method, constructor, or block in which they are declared. Local variables must be initialized before they can be used.
Example:
- Instance Variables:
These are variables that are declared within a class, but outside of any method, constructor, or block. They are also known as non-static variables, as they are associated with an instance of a class. Instance variables can be accessed and modified using the instance of the class.
These are variables that are declared within a class, but outside of any method, constructor, or block. They are also known as non-static variables, as they are associated with an instance of a class. Instance variables can be accessed and modified using the instance of the class.
Example:
- Class/Static Variables:
These are variables that are declared within a class, but outside of any method, constructor, or block, and are marked as static. Class variables are associated with the class itself, rather than with an instance of the class. They can be accessed and modified using the class name.
These are variables that are declared within a class, but outside of any method, constructor, or block, and are marked as static. Class variables are associated with the class itself, rather than with an instance of the class. They can be accessed and modified using the class name.
Example:
In this example,x
is declared as a static variable within theStaticVariablesExample
class. We can access and modify this variable using the class name, rather than an instance of the class. We can see this in themain
method where we useStaticVariablesExample.x
to access the value ofx
.
Reference variables are used to access and manipulate objects in Java. You can think of them as pointers in other programming languages. Unlike primitive data types (such as int, float, double, etc.), which hold the actual data value, reference variables hold a reference to the memory location where the object is stored.
Here is an example of a reference variable in Java:
In this example, we create a new String
object and assign its reference to the str
reference variable. We then assign the same reference to a new reference variable strRef
. Both reference variables point to the same object in memory. When we print the values of the two reference variables, we get the same output, which is the value of the String
object: Hello World
.
To calculate Test Estimation, check the link below:
Automation Test Estimation
Gmail Automation with Cypress & JavaScript
Basic Linux Commands for Automation QA
****************************************
TOP 15 BDD - CUCUMBER Interview Q&A
************************************************
✍️AUTHOR: LinkedIn Profile
************************************************
Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session
*************************************************
SeleniumWebdriver Automation Testing Interview Questions:
https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver
API Testing Interview Question Set:
https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html
DevOps Interview Q&A:
https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes
Docker Interview Question Set
https://automationreinvented.blogspot.com/Docker
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign
Java Related Interview Question Set
https://automationreinvented.blogspot.com/search/label/Java
GIT Interview Question Set:
https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html
Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions
Mobile Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Mobile%20Testing
Python Interview Question Set for QAE - SDET - SDE:
https://automationreinvented.blogspot.com/search/label/Python
No comments:
Post a Comment