String: Etl Labs PVT LTD - Java Programming
String: Etl Labs PVT LTD - Java Programming
String: Etl Labs PVT LTD - Java Programming
1. By string literal
2. By new keyword
String_Type string_variable = 3
“sequence_of_string”;
Example:
String s="welcome";
Example
String s=new
String("Welcome");//creates two objects
and one reference variable
• s1 == s2 :0
• s1 > s2 :positive value
• s1 < s2 :negative value
By extending By implementing
Thread class Runnable interface
11
ETL LABS PVT LTD – JAVA PROGRAMMING 9
Commonly used methods of
Thread class
public void run(): is used to perform
•
action for a thread.
• public void start(): starts the execution of
3
the thread. JVM calls the run() method on
the thread.
• public void sleep(long miliseconds):
Causes the currently executing thread to
sleep (temporarily cease execution) for the
specified number of milliseconds.
There are so many methods in threads class.