Posts

Tree in java

  package T rees ; class node { int val ; node left ; node right ; public node ( int val ){     this . val = val ; } } public class NodeTree { public static void main ( String [] args ) { node a = new node ( 1 ); node b = new node ( 4 ); node c = new node ( 3 ); node d = new node ( 2 ); node e = new node ( 6 ); node f = new node ( 5 ); a . left = b ; a . right = c ; b . left = d ; b . right = e ; c . right = f ; System . out . print ( "product of all nodes : " ); System . out . print ( product ( a )); System . out . println (); System . out . print ( "product of non-zero elements of nodes : " ); System . out . print ( product2 ( a )); System . out . println (); System . out . print ( "sum of all nodes : " ); System . out . print ( sum ( a )); System . out . println (); System . out . print ( "Maximum Node in tree : " ); System . out . print ( maximum ( a )); System . out . println (); System . out . print ( ...

Exception Handling.

Try Catch -> // Arithmatic Exception p ackage E xception_ H andling ; public class try_catch {     public static void main ( String [] args ) {         int a = 10 , b = 0 , c ;         try {             c = a / b ;             System . out . println ( c );         } catch ( ArithmeticException e ){             System . out . println ( e );         }     } } // NullPointer Exception package E xception_ H andling ; public class try_catch {     public static void main ( String [] args ) {         String s = null ;         try {             System . out . println ( s . toUpperCase ());         } catch ( NullPointerException e ){             System . out . ...

dbms

Image
  --‐-‐---------------------------------------------------------------------                                                                                                   

javascript

Image
console . log ( "ved varshney" ); fullName = "dhruv" ; age = 22 ; price = 99.99 ; x = null ; y = undefined ; isfollow = true ; fullName = 45 ; console . log ( fullName ); data types primitives let age = 22 ; console . log ( age ); let name = "ved" ; console . log ( name ); let price = 100.78 ; console . log ( price ); let isfollow = true ; console . log ( isfollow ); let u = undefined ; console . log ( u ); let n = null ; console . log ( n ); let x = BigInt ( "123" ); console . log ( x ); let y = Symbol ( "hello!" ); console . log ( y ); non primitive const student = { fullName : "ved" , age : 22 , cgpa : 8.87 , ispass : true }; console . log ( student ); console . log ( student [ "age" ]); console . log ( student . age ); student . age += 1 ; console . log ( student . age ); console . log ( typeof student . age ); operator and conditional statement power operator let a = 5 , b = 2 ; console . l...