What is Static and Non-Static in Java - CoreJava Part - 10

preview_player
Показать описание
Java Basics - Part 10 - Concept of Static Method and Variable In Java

Learn:

when to use static methods in java
static vs non static methods in Java
static and nonstatic class in java
difference between static and nonstatic class in java
difference between static and nonstatic member function in java
non static definition
static vs non static methods java performance

=======================================
Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:

Follow me on my Facebook Page:

-~-~~-~~~-~~-~-
========================================================
Please watch: "Selenium & Automation Interview Preparation - By Naveen AutomationLabs"
-~-~~-~~~-~~-~- Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:

Follow me on my Facebook Page:

Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:

Paid courses (Recorded) videos:
📗 Get My Paid Courses at
Paid courses (Recorded) videos:
-------------------------------

✔️SOCIAL NETWORKS
--------------------------------

Support My Channel✔️Or Buy Me A Coffee
--------------------------------
✔️Thanks for watching!
देखने के लिए धन्यवाद
Благодаря за гледането
感谢您观看
Merci d'avoir regardé
Grazie per la visione
Gracias por ver
شكرا للمشاهدة
Рекомендации по теме
Комментарии
Автор

Static v/s Non-Static in Java! The most important topic for interview point of view.
Subscribe and press the bell icon for more useful videos!

naveenautomationlabs
Автор

Summary: To access static and non static inside each other,
/* Static method inside static method:
* 1. Directly
* 2. Using class name.
* 3. Using object but throw warning.
*
* Static Global Variable inside static method:
* 1. Directly
* 2. Using class name.
* 3. Using object but throw warning.
*
* Static method inside non static method:
* 1. Directly
* 2. Using class name.
* 3. Using object but throw warning.
*
* Static Global Variable inside non static method:
* 1. Directly
* 2. Using class name.
* 3. Using object but throw warning.
*
* Non static method inside static method:
* 1. Only using object
*
* Non Static global variable inside static method:
* 1. Only using object
*
* Non static method inside non static method:
* 1. Directly
* 2. Using object
*
* Non Static global variable inside non static method:
* 1. Directly
* 2. Using object
*/

RahulJha-bucv
Автор

Hi Naveen, Can you please explain how we are deciding we need to create static or non static, like what is the advantage for creating static, in this video I just came to know that how we have to access the variable and how we can call methods,  on which parameter are deciding for static and non static.

BhardwajFamily
Автор

Hi Naveen, i am a functional manual tester with 12 years experience. I am studying Java for the first time to lean selenium. Your videos are very easy to understand. Thanks a lot for your time.

ramakrishnants
Автор

Awesome video Naveen. Well explained as always. Here's a question, I got..
Static method surely helps save memory as no object needed to call, isn't it ?? If this is so, can't we use the static method all over the java program?

Ajit-kdoi
Автор

Hi Naveen thank you for making this so easy

ankitachipkar
Автор

Quick question.
What is difference between global variable and instance variable? Are both same? Also what is class variable ?

amitpuranik
Автор

Hi Naveen, I have one question?
public static void m1()
{ s.o.pln("ram")
int i=10;
}
p.s.v.m(String[] arg)
{
//my question is->kissi bhi static method ke value ko main method me call kaise kru. Apne bola static method ko do tarike se call kr skkte hai 1.directly 2.using class name. but jab maine dono tarika use kiya to usme bs "ram" print hua. Int ki value print hi nai ho rhi. usko kaise print kre. Hope you understand my question. Please help me ASAP. thanks in advance.
}

satyamsingh-mhfp
Автор

letters (program what you write) are not visible as in the previous sessions. all previous 8 sessions were clear. Could you please see, if that can be changed.

DiyaSanviAtrocities
Автор

but sir google said "non-static methods can access any static method and static variable also, without using the object of the class". how???

harishchaudhari
Автор

very very helpful sir,
Thank you very much

cloudskills
Автор

Hi naveen, i have a question. Can we use the values of static variables in objects of that class.suppose i make 3 oblects and wants to have the value of x which is static and y which is non static...can we call these by 2 by obj.x and simply obj.y.and i value of y would be equally shared in all objects or what?

urzaelectronics
Автор

Such an amazing explanation, Thank you thank you

shababe
Автор

can static methods from other methods also be called directly in the main?

victorvaldez
Автор

can class be static in JAVA. Can we create object of static class. if yes then how?

basbakaiti
Автор

All clear! step by step going ahead...

devjewel
Автор

We can access static methods with obj reference

rajeshrijadhav
Автор

Hey Naveen. Could you please extend this video n say if we can make a class static ? will that be instantiated ?

deepikaragunathan