How to find Class of Object
public class Main { public static void main(String args[]) { A objA = new A(); if(objA instanceof A) { System.out.println(objA.getClass()); } } } class A { }
How to find Class of Object
public class Main { public static void main(String args[]) { A objA = new A(); if(objA instanceof A) { System.out.println(objA.getClass()); } } } class A { }
How to find Length of Array
public class Main { public static void main(String args[]) { int[] a = {1,2,3,4,5}; System.out.println("Length of array " + a.length); } }
Two Dimensional Array – Java
class Main { public static void main(String args[]) { int[][] a = {{1,2}, {3,4}}; System.out.println("Content of array " + a[0][1]); System.out.println("Length of array " + a[0].length); } }
OP: Content of array 2
Length of array 2
public class Main11 { public static void main(String args[]) { String[] arrName = new String[5]; int[] arrAge = {21, 25, 24, 26, 27}; char[] arrSection = {'A', 'B', 'C', 'D', 'E'}; arrName[0] = "Mugil"; arrName[1] = "Vinu"; arrName[2] = "Madhavan"; arrName[3] = "Adhavan"; arrName[4] = "Suryan"; //Method 1 for(int i=0;i<arrName.length;i++) { if(arrName[i] != null) System.out.println(arrName[i]); } //Method 2 //For - Each Method for(String item : arrName) { System.out.println(item); } //Method 3 int j =0; while(j<arrAge.length) { System.out.println(arrAge[j]); j++; } //Method 4 int k=0; do { System.out.println(arrSection[k]); k++; }while(k<arrSection.length); } }
How to use interface Java
public class Main { public static void main(String args[]) { BallAttributes objBallAttributes = new BallAttributes(); RubberBall objRubberBall = new BallAttributes(); objBallAttributes.bouncable(); objRubberBall.moveable(); } } class BallAttributes implements RubberBall, Movable { public void bouncable() { System.out.println("I am Bouncing"); } public void moveable() { System.out.println("I am Moving"); } } interface RubberBall { public void bouncable(); } interface Movable { public void moveable(); }
class Welcome { public static void main(String args[]) { B b = new B(); b.callme(); } } abstract class A { abstract void callme(); } class B extends A { void callme() { System.out.println("B's implementation of callme."); } }
How to Switch States in Jquery Between Yes or No
.CrossMe { background : url(CrossMe.gif) no-repeat; cursor : pointer; float : left; height : 44px; width : 51px; } .TickMe { background : url(TickMe.gif) no-repeat; cursor : pointer; float : left; height : 44px; width : 49px; } .NotInterested { background : url(NotInterested.gif) no-repeat; cursor : pointer; float : left; height : 44px; width : 241px; } .Interested { background : url(IamInterested.gif) no-repeat; cursor : pointer; float : left; height : 44px; width : 243px; }
Jquery to Change Class
$('document').ready(function(){ $('.CrossMe').click(function(){ $(this).toggleClass('TickMe'); var prevClass = $(this).prev().attr('class'); if(prevClass=='Interested') { $(this).prev().removeClass('Interested').addClass('NotInterested'); } else { $(this).prev().removeClass('NotInterested').addClass('Interested'); } }); });
HTML to create divs
What is Shell?
Computer understand the language of 0’s and 1’s called binary language.In eaarly days of computing, instruction are provided using binary language, which is difficult for all of us, to read and write. So in Os there is special program called Shell. Shell accepts your instruction or commands in English (mostly) and if its a valid command, it is pass to kernel.
Shell is a user program or it’s environment provided for user interaction. Shell is an command language interpreter that executes commands read from the standard input device (keyboard) or from a file.
Shell is not part of system kernel, but uses the system kernel to execute programs, create files etc.
Several shell available with Linux including:Bash, CSH, KSH, TCSH
To Find the list of Shells available in your system Type the below in your terminal
cat /etc/shells
Any of the above shell reads command from user (via Keyboard or Mouse) and tells Linux Os what users want.
To find the current shell you are using now use the below command
echo $SHELL
what is Shell script?
“Shell Script is series of command written in plain text file. Shell script is just like batch file is MS-DOS but have more power than the MS-DOS batch file.”
mugil@metro:~$ sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
For Creating new Folder in windows use the following Key Combination
alt + F + W + F
You should hold the alt key and Press F and with out releasing the alt key press W and F.
Alternate Method
You Can also do this by Right Click in Mouse followed by W and F
Two tables
CREATE TABLE tblEatables ( `EatId` int UNSIGNED PRIMARY AUTO_INCREMENT, `Fruits` varchar(9) NOT NULL ) Engine=InnoDB; CREATE TABLE tblConfirm_Eatables ( Eatables_Id INT UNSIGNED, Edible_Status INT, FOREIGN KEY Eatables_Id REFERENCES tblEatables (EatId) ) Engine=InnoDB;
Rows in Tables
INSERT INTO tblEatables(`EatId`, `Fruits`) VALUES(1, 'Apples'), (2, 'Oranges'), (3, 'Papaya'), (4, 'Jackfruit'), (5, 'Pineapple'), (6, 'Mango'); INSERT INTO tblConfirm_Eatables VALUES(1,0), (2,1), (3,0), (4,0);
The Result Should be
Fruits Apple Papaya Jackfruit Pineapple Mango
Query1
SELECT Fruits FROM tblEatables AS E LEFT JOIN tblConfirm_Eatables AS CE ON E.EatID = CE.Eatables_ID WHERE CE.Edible_Status = 0 OR CE.Edible_Status IS NULL
Query 2
SELECT e.EatId,e.Fruits FROM @tblEatables e LEFT JOIN @tblConfirm_Eatables ce ON e.EatId = ce.Eatbles_Id WHERE ce.Edible_Status = 0 OR ce.Edible_Status IS Null
Query 3
SELECT fruits FROM tblEatables WHERE EatID NOT IN (SELECT Eatables_Id FROM tblConfirm_Eatables WHERE Edible_Status = 1)
How to use Urnary operator in PHP
$ConfirmStatus = $lngConfirmSiteVisit == 1?1:0; $ConfirmStatus = $lngConfirmSiteVisit == 1?'Confirmed':'Pending';