In my opinion, learning should be free. So I am providing video lectures on JAVA SE for FREE. Good things about the channel 1) You will get complete series in a sequence chapter wise. 2) You can comment your queries, I will try to respond 3) Videos are in Hindi, to make you comfortable with the learning. 4) You will get all about JAVA. You will get a new video every week You can also visit my website www.mysirg.com to get links of my other channels and more intellectual content
FileInputStream creates a copy of file from ROM to RAM. This copy is buffer space which is used by program. Object of FileInputStream class points to this buffer space. FileInputStream can be used for READ only.
1. Java program is saved in 2ndary storage. 2. Program runs in Primary storage. 3. Variables and objects in the program holding data is created in primary storage while program execution. 4. Life of data members is less or equal to life of program. 5. If requirement is there for data persistence even after program life, then to store in 2ndary storage. Scope & Life of variables: 1. Instance member:- Scope: inside the class except static method. Life: until object is alive. 2. Static member: Scope: inside the class. Life: lifetime of program. 3. Local member: Scope: inside the method where declared. Life: until control leaves the method where declared.
System.in: 1. System is a final class 2. in is final static member variable containing reference of object of InputStream class. It copies Keyboard input to Buffer. Scanner is class which has a constructor accepting object of InputStream class. Scanner class contains nextXxx() method which converts content in buffer into Xxx type. Data in buffer is separated by delimiter which can be space, tab, enter.
Rules: 1. All methods in java will be a member of any class. 2. Outer class can be public or default. 3. Inner class can be public, protected, default or private. 4. There can be only 1 public class in a java file whose name will be same as public class. 5. Class name starts with Capital letter, follows PascalCase, is a noun. 6. Method name starts with small letter, follows camelCase, is a verb. 7. java.lang package is auto imported in any java file. Explain public static void main: 1. As JVM calls main method so its public 2. As JVM calls main w/o creating object of class containing main method so its static. 3. By convention main needs to return void. 4. By convention main method to be named as such. 5. By convention main method accepts a array of String. Explain System out println: 1. System is a final class in java.lang package. 2. out is a final static member variable containing reference of an object of PrintStream class. 3. print() and println() are instance member methods of PrintStream class.
public class Echo{ public static void main(String args[]){ for(int i=0; i<args.length;i++) System.out.println(args[0]); } } Sir isme kyu koi output nahi aa raha. Sahi kijiye
String class is: 1. final i.e., can't be inherited. 2. immutable i.e., when object value is changed, a new object is created and the reference variable points to new object. Two ways to create String object: 1. using string literal. 2. using new keyword and passing value into String class constructor. When object created by string literal, for two reference having same value, the 2nd reference starts pointing to 1st object in heap memory. s1==s2: reference address comparison s1.equals(s2): object value comparison.
Hi Saurabh sir, I am preferring to learn from your videos over other new teachers in 2024. This simply means you are the best teacher ❤️ I know mujhe ye JAVA series kuch saal pehle hi complete kr leni chahiye thi. But better late than never. 🙂 I am starting this series now.
@@rahul_nandwana very very thanks for reply, I just thought that as there have been so many updates, versions so this series would have been outdated but thanks for the reply, had u completed?
In interface: 1. Method are implicitly public and abstract. 2. Variables are implicitly public static final. w/o providing the keywords while declaring the methods and variables. Interface cannot have constructor as it doesn't have instance member variables. We can create reference variable of interfaces. As Interface can extend multiple parent interface. And class can implement multiple interface. We can achieve multiple inheritance in java using above behavior. Interface can have nested interface which will be public by default.
If any class contains at least one abstract method, it needs to declared as an abstract class. That doesn't mean abstract class needs to have an abstract method. Abstract class can have: 1. static variables and static methods. 2. instance member variables and methods. 3. Constructor which are called when a regular method inherits the abstract class and by constructor chaining parent constructor runs before child constructor runs. 4. final member variables and final regular method But not final abstract method as making a method final means it can't be overridden and abstract means it should be overridden. So it becomes opposing.
Why use abstract class? We have to create a parent class in real world. But for that institute that parent class's instantiation is not valid. So we put a check so object can't be created of that parent class. We can create reference variable of an abstract class.
this and super both contains reference of caller object. Their lifetime depends on method lifetime. this holds caller object reference. super holds reference of the parent of caller. Parent reference variable can contain parent object. Parent reference variable can contain child object but can't call a child class method. Child reference variable can't contain parent object as, logically: child is a type of parent but parent is not type of child, practically: child reference variable will expect child methods which parent object doesn't contain. Child reference variable can contain child object.
this: Instance member function contains this reference variable which contains reference of caller object. Lifetime of this depends on lifetime of function. Constructor also have this as its also a instance member method. this can't be used in Static context like static method. Inside a method the local variable (which is always instance variable as we can't have local static variable) gets first preference if there's a variable name conflict.
Firstly I doubted that you could explain this concept clearly but after seeing this video I can boldly say that this is the best video on Inner class concept on youtube🎉 Hats off to you sir❤
Sir ye program android me run kar rahe h to compile aur run ho hi nahi raha means kuchh output nhi de raha run karne par . jabki variable bhi lekar check kiya fir bhi nhi aaya
this(); represents constructor of same class. with use of this(); we can call second constructor of the same class from first constructor. If this() is used super() is not called. This is called constructor chaining.
constructors are not inherited. when a child object is initialized, its constructor should run, and before running its own constructor, it run its parent's constructor. super() is used to explicitly call parent class constructor from child class. super() should be first line inside child constructor. If parameterized constructor is created by programmer, compiler will not create default non parameterized constructor.
both static and instance member functions are inherited. If method name and signature is same: overriding happens for instance member functions in inheritance. function hiding happens for static member functions in inheritance. -------------------- static member variables are not inherited, if a variable with same name is declared it hides parent version.
We can have static: 1. member variables 2. member function 3. inner class Static local variables is not allowed as static is meant to be of the class and local variables are limited to the scope of method. Static outer class is not allowed as outer class is implicitly static and we use them to call static inner class, static member variable or static member function. static member function can only access static member variables. static inner classes can only access static member variables and methods.
We must initialize a final instance or static member variable, otherwise, the compiler will throw a compile-time error. Instance member variable can be initialized: 1. While declaration. 2. Inside Instance initialization block. 3. Inside constructor. Final can be used with: 1. Instance member variable- forces programmer to initialize and stops changing its value. 2. Static member variable-forces programmer to initialize and stops changing its value. 3. Local variable-only stops changing its value (as local variable by default has to be initialized). 4. Class-stops extending the class. 5. Method-stops method overriding.
Polymorphism: 1. Method Overloading: decided at compile time method with same name but different input parameter signature(number, type, sequence) Overloading not possible by changing the return type and keeping input signature and name same, because of ambiguity, will throw compile time error. Situations for overloading: Method can be in same class, either both in parent or both in child. One method in parent, other in child. 2. Method overriding: method with same name and signature but one is defined in parent and another in child. overriding is used when requirement is to change only implementation.
Initialization block contains some lines of code w/o any return, but it can use this & super keyword. After a object is instantiated, Initialization block is executed before Constructor execution. It runs every time an object is created. Static initialization block is identified by static keyword before block. It can only access static members. Static block is executed single time during: 1. object of class is initialized 2. static member is called. 3. static member is assigned a value. static block can't use return, this or super keyword.
1. Outer class can be either public or default 2. Inner class can be all 4 types 3. Each .java file can have only 1 public outer class, name of the file shud be the class name
public class Asso_precedence_op{ public static void main(String []args){ int a= 6*5-34/2; System.out.println("a"); } } Sir ye run karne pe kyu output a show kar raha jabki solve karke show karna chahiye
I have been watching you since last 6 years my dear sir you are a different sort of teacher. Awesome way of making us understand. One day i must meet you. Hope you will not deny