Comprehensive Java Concepts Overview
Comprehensive Java Concepts Overview
Oops concept
Abstract vs Interface
String Buffer vs String Builder
When String and when builder or buffer
Why String is Immutable
Why other datatypes (int, short) are mutable
Static vs Final
Final vs finally vs finalize
Method overriding vs method overloading
Serialization
Synchronization
Array vs arraylist
Arraylist vs Linkedlist
List vs set
Hashmap vs HashTable
ConcurrentModificationException
why Concurrent Hashmap
Internal working of Hashmap new change
collusion Issue
Custom Exception
Some methods of object class
Reason for collision inside hashMap
can we have exception without catch block
Threading
Wait vs Sleep
notify & notifyAll
Garbage Collection
Comparable vs comparator
ThreadSafe
Can we have Parent Exception then sub excepti
Functional Interface with example
throw vs throws
process required to have a class as Singleton
composite key
what is Functional interface and write one example
Java 8 features
can we override static method
static and instance block
static -> instance -> constructor
Linked List
Sorted set & Tree set
BigInt & BigDecimal
AtomicInteger
function(Object) vs funtion(String)
"== vs equals"
[Link]() and [Link]()
Daemon thread
How can I make a field non-serializable
deadlock
Leaders in an array
volatile vs Synchronized
object de-referencing
Y override both equals and hashcode.
How duplicate are avoided in Set
how to make a class imutable
Stream flatMap
can we serialize a static content
design pattern
Spring
Scope in spring
inside web. xml?
why spring
Dependency injection & IOC
how many ways Injection can be achived
Autowire
Controller vs restcontroller
Known annotations
Qualifier
how to handle exception in spring
profiling
@Component vs @Bean
SpringBoot
RestApi
Write any one restapi class ( restcontroller class)
Sql
Joins
Left join
Write query in left join
Query vs subquery
LIMIT
Index
Bank balence with trancation table
max salary
y view
others
Agile Methodology process
Micro Services
Program questions
Find first non repetitive value in string
programs in stream API
count Occurance of each word or character from a string
count occurrences of each item in list stream jav
HTML vs HTML5
CSS vs CSS3
DOM vs Virtual DOM
Inheritance, Polymorphism, Abstraction, Encapsulation
no multiple inheritance. | non-final,non-static variables.| can have private, protected var.| abstract and non-abstract
syncronized & thread safe vs non-syncronized & not thread safe.
The finalize() method of Object class is a method that the Garbage Collector always calls just before the deletion/de
Object | releases lock during Synchronization| called only from Synchronized context, final vs Thread, static
compareTo, implemented by Class which need to be compared vs compare, passed as param for
return single_instance;
}
is a combination of two or more columns to form a primary key for a table.
e one example
Stream, lamda, functional interface, Default & Static methods in interface, Optional class.
No as overriding is run-time and static is class based and not runtime
called on class loaded vs called on object creation like constructor.
An element is leader if it is greater than all the elements to its right side.
[Link]
The reassignment or set null means ref has been "dereferenced". The dereferenced object is now eligible for Garba
If two objects are equal, then they must have the same hash code. If two objects have the same hash code, they m
TreeSet internally uses the HashMap which internally uses the Hashcode to determine the duplicates. If two objects
final class, final member variables, allArgsConstructor, getter alone.
List<List<String>> to List<String>.
we cant, as serializing is a process to stating an object into bytestream.
Singlton, builder, prototype, factory, adaptor, iterator, observer(creational, structural, behavioral)
troller class)
INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, Self Join, CROSS JOIN
Limit 0,1 Offset is like index and it sayd the starting point.
Order the
select column and used
name,sum(case whenalgoritm to retrivethen
transaction='C' data.
amount end) -sum(case when transaction='D' then amount end) a
from tablename group by name
select
2. *from
Views canemployee
be used as where salary=(select
a security mechanism Max(salary) from employee);
3. Views can simplify supporting legacy code
Common or sep
[Link]
[Link]
VDOM is abstraction of DOM without browser specific implementation.
Hibernate spring java
How will you connect hibernatenable debug in spring can we overload static method
Hibernate cascade life cycle of thread
Save vs persist
typecase
implicit
explicit
switch
Constructor
this
static variable
static block
static method
Inner Class
Array
Jagged Array
enhanced for
varargs
OOPS
HAS-A
super
diamond problem
Encapculation
boxing - wrapping
unboxing
auto-boxing
auto-unboxing
Abstract
Final
Interface
Anonymous Class
Marker Interface
Functional Interface
Default Method in Interfac
Access Modifier
protected
Exception
Scanner
Thread
start()
sleep()
join()
isAlive()
getName() & setName()
getPriority()
currentThread()
Runnable
Synchronized
collection
Collection
Collections
1.2
with Generics 1.5
1.7
Set
Map
HashMap
HashTable
Iterator
Collections
Comparable
Comparator
HashTable
Stream
Lamda Expression
parallelStream()
stream().methods()
map()
reduce()
filter()
forEach()
orElse()
findFirst()
distinct()
predicate Interface
java 9 + APIs
copyOf()
[Link]() | writeStri
predicate Negate
String
Switch Expression
Text Block
Records
compact constructor
SOLID
Single Responsibility Princip
Open-Closed Principle
Liskov Substitution Principle
Interface Segregation Principle
double d = 5;
int i = (int)5.5;
current instance
Note: The Java ClassLoader is a part of the Java Runtime Environment that dynamically loads Java classes into the
(Permanent Generation section of the heap)
static variable will be class specific and not instance specific.
can be accessed by object-ref or classname.
This will be called only when the class is loaded into JVM by classLoader.
non-static variable can't be accessed inside the static method or static block.
for(int i:num){}
method declaration | methodName(int ... varName);
final int i=10 can't be changed. | but final int ii; can be assigned once after that it cant be changed.
final class ClassName{} this cant be extended
final method this method cant be overriden.
These are not default but can be defined in interface. | java 8 feature.
Class can have final, abstract and public and not private and protected.
same package and child class.
make a method synchronized means only one thread can access the method at a time.
public synchronized
Synchronized block. void methodname(){}
Static synchronization.
topic
Interface
Class
[Link](collectionObject);
List is Mutable.
Interface have compareTo method which will be implemented by Objects like Integer. This will have a logic to sort()
Example: (thisValue < other) ? -1 : ((thisValue == other)? 0: 1);
To use sort on a Collection with a GenericObject that GenericObject need to implement Comparable Interface.
Implement the compareTo method based on that sort will work.
This is a Interface. with compare method
Comparator obj = (i, j) -> {};
[Link](collectionObject, comparatorObject);
This is syncronized.
for, iterator, Enhanced for are External Iterator. Stream is Internal Iterator.
->
[Link]().forEach(consumerInterfaceObject);
Consumer Interface is a functional Interface with accept method.
method Ref forEach([Link]::println)
this will create the multi thread and run.
intermidiate method
terminal Method. reduce(initialValue,(result,eachitem) -> {});
intermidiate method
terminal Method.
can be used after optional Method
optionalMethod
intermidiate method
Functional Interface with test method.
filter(PredicateObject).
stream is lazy once findFirst get one value then the intermidiate method will not run for other items.
List , Set, Map has this method. this will create and return a collection immutable having the same values as the pa
Path path = [Link]("./[Link]"); [Link](path,"asdasdasd");
filter([Link]()) | filter([Link](methodRef))
isBlank()
strip()
stripLeading()
stripTrailing()
Stream<String> obj = "asd/nasd/nasd/nasd/n".lines();
"asdasd %s asdasd %d",formatted("Name", 25);
JDK 10
var obj = new ClassName();
java complier will infer the type if we mention var.
var obj = null; (this is not possible)
var can't be used for member variables.
JDK 14}
};
beark; can't be used with switch expression. yield will act like return.
for one line we can use ->
JDK 15
""" content asdasd asdasd """
this 2
line can hav new line tab without escape seqance.
line 3 """
starting """ should be followed by new line.
all operation on string can be done in textBlock.
JDK 16
record RecordName(String stringName){}
record will create Constructor,equals,hashcode,getter,setter,toString methods automatically.
record
} RecordName(String stringName){ override those methods }
}
we can have static variable, block and methods
we can't have instance variable and instance methods.
The principle states that we must use abstraction (abstract classes and interfaces) instead of concrete implementat
on(say what to do and not how it is done)
(has-a), Composition(is-a)
SELECT
SELECT DISTINCT
WHERE
condition
ORDER BY
INSERT
NULL
UPDATE
DELETE
SELECT LIMIT
OFF SET in the LIMIT
MIN()
MAX()
COUNT()
AVG()
SUM()
LIKE
Wildcard
IN
BETWEEN
Aliases
JOIN
INNER JOIN
LEFT JOIN
RIGHT JOIN
FULL OUTER JOIN
Self Join
CROSS JOIN
UNION
UNION ALL
INTERSECT
EXCEPT
GROUP BY
GROUPING SETS
HAVING
EXISTS
ANY
ALL
SELECT INTO
CASE
NULL Functions
Comments
Stored Procedures
CREATE DATABASE
DROP DATABASE
BACKUP DATABASE
CREATE TABLE
DROP TABLE
TRUNCATE TABLE
DELETE v TRUNCAT
ALTER TABLE
RENAME
Constraints
PRIMARY KEY
FOREIGN KEY
CHECK Constraint
DEFAULT Constraint
CREATE INDEX
DROP INDEX
AUTO INCREMENT
CREATE VIEW
UPDATE VIEW
DROP VIEW
Trigger
CREATE TRIGGER
DROP TRIGGER
Prepared Statement
PREPARE
EXECUTE
DEALLOCATE
PostgreSQL
ILIKE
ON CONFLICT
DO NOTHING
Syntax / Keyword / Note
Data Definition Language - (CREATE, DROP, ALTER, TRUNCATE, COMMENT , RENAME)
Data Query Language - (SELECT)
Data Manipulation Language - (INSERT, UPDATE, DELETE)
Data Control Language - (GRANT, REVOKE)
Transaction Control Language - (COMMIT, ROLLBACK, SAVEPOINT, SET TRANSACTION)
SELECT column1, column2, ... FROM table_name ORDER BY column1, column2, ... ASC|DESC; Note: for each c
INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);
INSERT INTO table_name VALUES (value1, value2, value3, ...);
NULL value is different from a zero value or a field that contains spaces. A field with a NULL value is one that has
IS NULL / IS NOT NULL
UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;
The MIN() function returns the smallest value of the selected column.
SELECT MIN(column_name) FROM table_name WHERE condition;
The MAX() function returns the largest value of the selected column.
SELECT MAX(column_name) FROM table_name WHERE condition;
SELECT COUNT(column_name) FROM table_name WHERE condition; Note: NULL values are not counted.
The AVG() function returns the average value of a numeric column.
SELECT AVG(column_name) FROM table_name WHERE condition;
The SUM() function returns the total sum of a numeric column.
SELECT SUM(column_name) FROM table_name WHERE condition;
SELECT column1, column2, ... FROM table_name WHERE column LIKE pattern;
% Represents zero or more characters
_ Represents a single character
[] Represents any single character within the brackets Note: h[oa]t finds hot and hat, but not hit
^ Represents any character not in the brackets Note: h[^oa]t finds hit, but not hot and hat
- Represents a range of characters Note: c[a-b]t finds cat and cbt
c[!a-b]t finds cot and clt not cat
SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2;
SELECT column_name(s) FROM table_name WHERE column_name NOT BETWEEN value1 AND value2;
SELECTcolumn_name
SELECT column_name ASAS alias_name
aliasname, FROM table_name;
column_name AS [alias name] FROM table_name;
Note: It requires double quotation marks or square brackets if the alias name contains spaces:
SELECT CustomerName, CONCAT(Address,', ',PostalCode,', ',City,', ',Country) AS Address FROM Customers;
RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left table
FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table
SELECT [Link], [Link] FROM Orders INNER JOIN Customers ON [Link]
SELECT column_name(s) FROM table1 LEFT JOIN table2 ON table1.column_name = table2.column_name;
SELECT column_name(s) FROM table1 RIGHT JOIN table2 ON table1.column_name = table2.column_name;
SELECT column_name(s) FROM table1 FULL OUTER JOIN table2 ON table1.column_name = table2.column_nam
SELECT column_name(s) FROM table1 T1, table1 T2 WHERE condition;
SELECT select_list FROM T1 CROSS JOIN T2;
The CROSS JOIN gets a row from the first table (T1) and then creates a new row for every row in the second table
The columns must also have similar data types
The columns in every SELECT statement must also be in the same order
UNION
SELECT column_name(s) FROM table2;
UNION ALL
UNION operator selects only distinct values by default. To allow duplicate values, use UNION ALL
SELECT column_name(s) FROM table2;
INTERSECT combines result sets of two or more queries and returns distinct rows that are output by both queries.
EXCEPT compares the result sets of two queries and returns the distinct rows from the first query that are not outp
HAVING clause was added to SQL because the WHERE keyword cannot be used with aggregate functions(count m
WHERE COUNT()
SELECT this cantFROM
column_name(s) be used for this weWHERE
table_name are using HAVING. HAVING can be used only with GROUP BY.
condition
GROUP BY column_name(s) HAVING condition ORDER BY column_name(s);
The EXISTS
SELECT operator returns
column_name(s) TRUE
FROM if the subquery returns one or more records.
table_name
WHERE EXISTS (SELECT column_name FROM table_name WHERE condition);
FROM Suppliers
WHERE EXISTS (SELECT ProductName FROM Products WHERE [Link] = [Link] AN
returns TRUE
WHERE if ANY of operator
column_name the subquery
ANYvalues meet the condition
(SELECT column_name FROM table_name WHERE condition);
returns TRUE if ALL of the subquery values meet the condition
is used with SELECT, WHERE and HAVING statements
SELECT column_name
WHERE ALL column_name(s)
operatorFROM
ALL table_name WHERE condition;
(SELECT column_name FROM table_name WHERE condition);
SELECT INTO statement copies data from one table into a new table.
SELECT * INTO newtable [IN externaldb] FROM oldtable WHERE condition;
SELECT column1, column2, column3, ... INTO newtable [IN externaldb] FROM oldtable WHERE condition;
If WHERE condition is false an empty new table will be created.
INSERT INTO SELECT statement copies data from one table and inserts it into another table(existing table).
INSERT INTO
INSERT INTO table2
table2 (column1,
SELECT * column2,
FROM table1 WHERE
column3, ...) condition;
SELECT column1, column2, column3, ... FROM table1 WHERE condition;
If there
ELSE is no ELSE part and no conditions are true, it returns NULL.
result
END;
END AS QuantityText
FROM OrderDetails;
IFNULL(),ProductName,
SELECT ISNULL(), COALESCE(), and NVL() + IFNULL(UnitsOnOrder, 0)) FROM Products;
UnitPrice * (UnitsInStock
If UnitsOnOrder have NULL in any record it will be considered 0 as the functions second param is 0.
CREATE TABLE table_name (column1 datatype, column2 datatype, column3 datatype, ....);
DROP TABLE table_name;
TRUNCATE TABLE table_name;
Delete command places lock on each row requires to delete from a table. | Truncate command places a table and p
ALTER TABLE table_name ADD column_name datatype;
ALTER TABLE table_name DROP COLUMN column_name;
ALTER TABLE table_name MODIFY COLUMN column_name datatype;
ALTER TABLE table_name RENAME TO new_table_name;
ALTER TABLE table_name RENAME COLUMN old_name TO new_name;
....
);
ADD and DROP Constraint is possible with ALTER TABLE
NOT NULL constraint
UNIQUE (ID) enforces a column to NOT accept NULL values.
); CONSTRAINT UC_Person UNIQUE (ID,LastName)
);
Primary keys must contain UNIQUE values, and cannot contain NULL values
Same syntax KEY
FOREIGN as UNIQUE.
(PersonID) REFERENCES Persons(PersonID)
); REFERENCES Persons(PersonID)
); CHECK (Age>=18)
); CONSTRAINT CHK_Person CHECK (Age>=18 AND City='Sandnes')
); City varchar(255) DEFAULT 'Sandnes'
);
Triggers
FOR EACHare ROW
a particular type of stored procedure associated with a specific table.
<trigger body>;
<trigger time > (BEFORE or AFTER)
<trigger
END IF; event>
// (INSERT, UPDATE or DELETE)
delimiter ;
DROP TRIGGER <trigger name>;
Prepared Statement
forName()
DAO
[Link]
will load the class into classloader that will execute the static block.
[Link]("ClassName");
BeanFactory
ApplicationContext
[Link]
Bean Property
Construtor Injection
[Link]
@Autowired
AnnotationConfigApplicationContex
@Configuration
@ComponentScan
@Primary
@Qualifier
Configuration Inhertance
@PathVariable
[Link]
[Link]
Syntax / Keyword / Note
It is a java build tool
@Autowired on memberVariable of class will create a bean of memberVariable and assign to it.
}
With this we need to mention @Component on Classes.
This will clear the ambiguity issue. between two class inherts one interface and we request for Interface's Bean.
Class with Primary annotation's Bean will be return.
@Autowired
@Qualifier("beanName")
@Configuration
@import({[Link], [Link]})
[Link]
configure file
@Controller
@RequestMapping
[Link] ->
AbstractAnnotationConfigDispatcherServletInitializer
configure file
@RequestParam
Component Annotations
[Link]
</servlet-mapping>
</web-app>
[Link]
</bean>
</beans>
This will have the mapping. by this dispatcherServlet will know for which request which controller need to be called.
Annotation on methods for path mapping
public
} class WebXmlReplaceClass extends AbstractAnnotationConfigDispatcherServletInitializer
}
vletInitializer
Topic
SpringApplication
Spring Container
@scope
application property
profiling
[Link]
When the application start run all beans will be created and held in Spring Container.(Scope: Singleton)
@Component
@Scope(value="prototype")
by default it will be singleton
In Singleton Bean will be created when the application start to run.
In Prototype the Bean will be create whenever we call getBean();
[Link] / [Link]
mockito
Topic
@Test
@DisplayName
@RepeatedTest(5)
@ParameterizedTest
@ValueSource
@MethodSource
@Disabled
Assertions
JUnit Flow
@BeforeAll
@AfterAll
@TestInstance(Lifecylce.PER_CL
@Nested
Mockito
Mockito
mock
when()
verify()
[Link]
[Link]/watch?v=flpmSXVTqBI
[Link]
Syntax / Keyword / Note
Class in Junit
assertFlase, assertEquals, assertThrows
assertFalse([Link]().isEmpty());
assertEquals(1, [Link]().size());
[Link](null, "Doe", "0123456789");
});
This will be called before the instance of the class is created, So it should be static method.
This should also be a static method.
Will create only one instance to run all the test. And @BeforeAll and @AfterAll can be non-static.
It is a class
method | [Link]([Link]);
[Link]([Link](param)).thenReturn(valueToBeReturned);
verify([Link](param));
Topic
REST
REST API
stateless
REST Resource
URI
URL
URN
HTTP Methods
idempotent
POST vs PUT
Rest Template
[Link]
[Link]
PUT method uses the request URI to supply a modified version of the requested resource which replaces the origin
whereas the PATCH method supplies a set of instructions to modify the resource.
[Link]('url',[Link])
Topic
Types of Data Structures
Non-Primitive Data structure
Major Operations
Types of algorithm
Search Algorithm
Linked List
Types of Linked list
Skip list
Stack
Standard Stack Operations
Queue
Enqueue:
Dequeue
Other Operations
Types of Queue
Circular Queue
Priority Queue
Types of Priority Queue
Deque
Operations
Tree
term
Types of Tree
Binary Tree
Full/ proper/ strict Binary tree
Complete Binary Tree
AVL Tree
RR Rotation
LL Rotation
B Tree
Graph
Searching
Sorting
Bubble sort Algorithm
Bucket Sort
[Link]
A stack is an ADT (Abstract data type) which uses either arrays or linked list data structure for the implementation.
Singly Linked list, Doubly Linked list, Circular Linked list, Doubly Circular Linked list, Skip list
LIFO (Last-In-First-Out)
push, pop, isEmpty, isFull, peek, count, change, display
peek(): It returns the element at the given position.
change(): It changes the element at the given position.
display(): It prints all the elements available in the stack.
Linear
If Queue,
the rear Circular
reaches Queue,
to the PriorityofQueue,
end position Deque
the Queue then there might be possibility that some vacant spaces are left
So, to overcome such limitations, the concept of the circular queue was introduced.
The element with the highest priority would come first in a priority queue
Ascending order priority queue, Descending order priority queue
poll, add
Root, Child node, Parent, Sibling, Leaf Node, Internal nodes, Ancestor node,Descendant
Number of edges, Depth of node x(root to x), Height of node x(x to leaf)
General tree, Binary tree, Binary Search tree, AVL tree, Red-Black Tree, B Tree, B+ Tree
0 to 2 children
0 or 2 children.
The complete binary tree is a tree in which all the nodes are completely filled except the last level. In the last level, a
In a complete binary tree, the nodes should be added from the left.
A tree is a perfect binary tree if all the internal nodes have 2 children, and all the leaf nodes are at the same level.
The degenerate binary tree is a tree in which all the internal nodes have only one children.
The balanced binary tree is a tree in which both the left and right trees differ by atmost 1. For example, AVL and Re
Tree is said to be balanced if balance factor of each node is in between -1 to 1, otherwise, the tree will be unbalanc
A graph can be defined as group of vertices and edges that are used to connect these vertices.
Directed and Undirected Graph
Path, Closed Path, Simple Path, Cycle, Connected Graph, Complete Graph
Linear Search, Binary Search
Swap 2 element if need, loop through untill n-1 times. Ever loop will move the largest item to last index and next lar
[Link]
rom the front-end.
Classification of patterns
Creational patterns
Factory Method
Abstract Factory
Singleton
Prototype
Builder
Structural patterns
Proxy
Flyweight
Behavioral Design
Observer
Iterator
[Link]
[Link]
Syntax /patterns
Design Keyword / Note
are typical solutions to commonly occurring problems in software design.
They are like pre-made blueprints that you can customize to solve a recurring design problem in your code.
Common for OOPLs
Creational patterns, Structural patterns, Behavioral patterns
Factory Class will create and return the Object. Main class will call the create method in the Factory Class we creat
Factory of Factory.
private constructor, private static ClassName var = new ClassName();, only getter for the var.
above one is egar method.
lazy load the new key word will be in getter method with a conditional check.
create a clone of an object.
new [Link]().setVar().build();
a shared object that can be used in multiple contexts simultaneously. The flyweight acts as an independent object i
Chain of Responsibility, Command, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visit
DOM
JS will access the DOM not HTML.
Topic
CSS Selectors
Combinators
Pseudo-classes
Pseudo-elements
Attribute Selectors
Cascading Order
CSS comment
Backgrounds
outline-offset
position Property
static
relative
fixed
absolute
sticky
inline-block
link
CSS Counters
CSS Units
Specificity(priority)
A pseudo-class
Style visited andisunvisited
used to define a special state of an element.| :hover :focus :first-child
links differently
Style an element when it gets focus
A CSSthe
Style pseudo-element is used
first letter, or line, of antoelement
style specified parts of an element. | ::first-letter ::first-line ::before ::after
Insert content before, or after, the content of an element
A CSS comment is placed inside the <style> element, and starts with /* and ends with */:
a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!
a:active MUST come after a:hover in the CSS definition in order to be effective! Pseudo-class names are not case-s
CSS counters
content aregenerated
- Inserts like "variables".
contentThe variable values can be incremented by CSS rules (which will track how many
counter() or counters() function - Adds the value of a counter to an element
Start at 0, add 1000 for style attribute, add 100 for each ID, add 10 for each attribute, class or pseudo-class, add 1
float property is used for positioning and formatting content e.g. let an image float left to the text in a container. | left
When- The
both we use the float
element property,
is pushed andboth
below we want the right
left and next floated
elementelements
below (not on right or left), we will have to use the c
inherit - The element inherits the clear value from its parent
x but select top-xxx
line is transparent.
name or pseudo-element.
Crash 1
full course
Topic
Basics
Statement
Comment
Variables
Constant
Primitive Type
Reference Type
Object
this
Arrays
Operators
Control Statement
Conditional
loop
Functions
Types of function
this
try catch
DOM manipulation
document is WEB API not j
Timing Function
setTimeout()
clearTimeout()
setInterval()
clearInterval()
getComputedStyle()
hoisting
[Link]
[Link]
Syntax / Keyword / Note
Chrome has v8(JavaScript engine)
FireFox has SpiderMonkey(JavaScript engine)
Node is a C++
JavaScript is a program
languagethat hason
based a JavaScript
[Link] V8 (chrome's
A standard js engine).
for scripting languages like JavaScript, JScript is ECMA
JavaScript is considered as one of the most popular implementations of ECMAScript.
Put script tag at the end of elements in body. so the element will be rendered first rather than js computation.
scrpit will be included in head tg if js used from outside.
var a =8;
//
/* */
string
number
boolean
undefined
null | type of null is object
{} | json
var obj = {key:value, functionName: funtion(){}, ...};
var varName = new TypeName(args);
var varName = new String(); typeof varName -> object.
delete [Link]; will remove the key for that object.
this inside object ref to that current object instance.
this in general ref to window object
Arithmetic
Comparison
Logical or Relational
Assignment
Conditional | Trinary [?:]
String [+]
Type [typeof, instanceof]
Bitwise
spread | ...varName
rest | function functionName(...args) | rest param should be last in function declaration
if- else
switch case (number,boolean,string)
for for(int x=10, x>=0; x--){}
while
do .. while do{}while();
for...in
break
continue
function functionName(param,param,...){}
parameter is at the function declearation
argument is at the function calling statement.
no need to specify the type return by the function.
every function has a array called arguments which will have a values of all the params passed to the function.
default param function functionName(param = defaultValue){}
[Link](obj, param1, param2) | this will ref to obj inside the function
[Link](obj, [param1, param2]) | this will ref to obj inside the function
[Link](obj) | this will not call the function. it will return a function object.
<button onclick="functionName()">
[Link]();
[Link]();
[Link]();
execute a set a statement ONCE after a time interval
var ID = [Link](functionName,5000);
[Link]([Link]()).getPropertyValue("opacity");
[Link]([Link](),"::after").getPropertyValue("height");
[Link]
[Link]
Vite
Binding Text
{{}}
Data
v-text
Binding Attribute
v-bind
class binding
conditional binding
style binding
v-bind shorthand
Conditional Rendering
wrap html content
List Rendering
object iteration
key attribute
Methods
Event Handling
shorthand
event object
Modifier
Trim
Number
lazy
multi modifier
prevent
key
v-once
v-pre
Computed Properties
Method vs Computed
Computed Setter
Watch
Immediate
Deep
[Link]
[Link]
[Link]
[Link]
Syntax / Keyword / Note
[Link] check src in the video
<script src="[Link]
npm install vue@next
npm install -g @vue/cli
vue create <project-name>
npm run serve
npm init vite-app <project-name>
<html-tag>{{variabel-name}}<html-tag>
},
}
<h1 v-text="variable-name"></h1>
tag child will be completly replaced by v-text do it has to be empty.
Note: {{}} is faster than v-text.
<div v-html="variable-name"></div>
in js variable-name = "<b>text<b>"
v-on
<button v-on:click="method-name/ logic">label</button>
<button v-on:click="method-name(args)/ logic">label</button>
v-on:click="method-name" => @click="method-name
methodName(event){ [Link](event);},
},
in template if we pass arg then event will not be passed automatically
to pass event methodname(args,$event)
<button v-on:click="method-name1(args),method-name2(args)">label</button>
v-model
<input id="id" v-model="varName" />
note for checkbox group and radiogroup mention the v-model in each tag the same the array and var will update pro
}
}
both return the value once the depend var value change
Computed will be cached so if something in-depended of the computed is changed the result will not be re-calculate
This improve performance.
Computed will execute only any depended var change.
}
}
}
}}
}"
if immediate is set to true watch will be called on the page load.
If we watch an object and it's key's value updated then watch won't be called.
object { key: "value"}.
for this to be watched we need to set deep to true like immediate.
For array also same thing applies.
Basic
cheat sheet
continue
this is enough
Topic
Version control system
Git Configuration
end of lines
Config Level
help
git init
Work flow
Staging files
Removing files
Refer site
d, struct, dictionary, hash table, keyed list, or associative array.
quence.
[Link]
Topic
regex
Flag
global
case insensitive
/[0-9]{5}/
/[0-9]{0,20}/
/[0-9]+/
\d
\w
\s
\t
[^a-b]
^
$
() parts in regex
()?
[Link]
Syntax/ Note
/<regex>/flag | multiple flags are allowed /<regex>/gi
/<regex>/g | match all if mentioned, if not only the first set will be find.
/<regex>/i
5 digits
0 to 20 digits
any number of digits
[0-9]
match any word cahr [a-z][A-Z][0-9]
match whitespace (space or tab)
tab
not a to b
start point
end point
email /([a-z A-Z 0-9\.-]+)@().()/
optional
Topic
Syntax / Keyword / Note
Mango DB [Link]
The Future interface is more useful if you submit a Callable to the pool. The return value of the call met
Execute vs S
double checkDouble-checked locking is the practice of checking a lazy-initialized object's state both before and after
how can you improve the efficiencyof DAO layer [Link]
jpa repositor[Link]
how to call [Link]
how to defin [Link]
Virtusa
spring batch
Oracle
The return value of the call method will be returned when you call [Link]. If you don't maintain a reference to the Future, th
ect's state both before and after a synchronized block is entered to determine whether or not to initialize the object
[Link]?m=1
eference to the Future, there is no difference.
ze the object