Posts

Showing posts from March, 2022

Anstrong Number (teeno ka add karna par bhi same aya )

 Angstroms Number  int a = 1153; 1 ka cube , 5 ka cube and 3 ka cube. int a = 153; int c = 0; while(a > 0 ){ int b = a%10; b = b*b*b; c += b; a = a/10; } System.out.println(c);

Function Overloading

Image
 function overloading happens two or more function with the same name   with different parameters or arguments  fun(34); fun("hello"); static void sum(int a){ System.out.println(a) } static void sum(String a){ System.out.println(a); } At compile time it's decide which function to take  no of argument should be different or no of type should be different 

Scoping and Variablelength Arruguments

Image
 public class HelloWorld{      public static void main(String []args){         System.out.println("Hello World"); int b = 200;       sum();      }      static void sum(){          int a  = 100;                    System.out.println(a);      } } function scoping jasa ya sum() wala method ka under hum b ko access nahi kar sakta because wo function scope ka bahar haa  sum(){ }  Block level scope { } public class HelloWorld{      public static void main(String []args){         System.out.println("Hello World")         {             int c = 100;         }         System.out.println(c);      } } asa karana ga toa error aya ga because hum block ka bhar c ko print karwa...

First java Program

Image
 every  thing is class like  file ka name .java sa save hota haa jo je ake class haa class Main{ } java par bhi  Capital letter sa start ho vo Class ka under ata haa  class ka matlab name,group of properties and function class are know as method  Scanner jo haa onput lana ka lia  System.in    ka matlab haa keybord sa input lana ka lia  Type Casting :- 

Function/Method in Java

 public class HelloWorld{      public static void main(String []args){       sum();      }    static void sum(){          System.out.println("hello world");      } } public class HelloWorld{      public static void main(String []args){         System.out.println("Hello World");                  int a = sum();         System.out.println(a);      }     static int sum(){         return 20;     } }

Intro to Java

Image
 

Flow of Program

Image
 

Static vs Dynamic languages

Image
 Static languages :- japar bhi datatype dena padta haa like java (int a, String b) perform type checking at compile time  Error will show at compile time  Declare data type before we use it   (int, String , Float a ) like in java  More control  Dynamic languages : -  jaha par bhi data types mention karna ka jarut an pada like in javascript (var a = 10) Perform type checking at runtime  Error might not show till program is run  No need to declear data type  of variables  save time while writing code but might give error  at runtime * I have to read about runtime error and compile-time error  Memory management  variable refrence and function ka memory stack mae save hota haa vahi par  value or we say object  heap memory mae save hoat haa variable a  reference dea raha haa object 10  ko  Garbage collection :- jab kisi object ka name an ho toa ya garbage collection apena ape remove kar d...

Types of Languages

 types of languages :-  1)Procedual  2)Functional 3)Object Oriented 1)Procedual languages ka matlab hota haa  a series of well structure steps and produce to compose a program  contain karta ha ake systematic order of statements and command to complete the task. 2)Functional Languages ise mae hum functions ka use karta haa  we can reuse again and again it is a  program only in pure function jo ke never modify variables, but only create new one as an output use hum asa jagha karta haa jaha pae we have to perform lots of different operations on the same set of data  first class function. first class function ka matlab ja par bhi ake function ko dusra function mae reassign kara toa first class function. a = 10; c = a; 3)Object oriented : -  the code file and data combine together to form a object  revolve around objects code + data = object developed to make it easier to develop, debug, reuse , and maintains software