Filter in AngularJs

<!DOCTYPE html> <html> <head> <script src=””></script> <script> var app=angular.module(‘myApp’,[]); app.controller(‘ct’,function($scope){ $scope.arr=[“Shiv”,”Jagan”]; }); </script> </head> <body> <div ng-app=”myApp” id=”u” ng-controller=”ct”> Name<input type=”text” ng-model=”userName”/> <ul> <li ng-repeat=”x in arr|filter:userName”> User Name:{{x}} </ul> </div>

Exception Handling puzzle

Hi please pay close attention to this small code snippette. As our rule says exception handling mechanism The finally block always gets executed even if we are using the return statements. The code will return the OP as 30 public class TryCatchDemo { static int giveInt() {      try      {            return 10;      }      catch(Exception e)     …

Read More Read More

StringBuilder Demo

public class StringBuilderDemo {      public static void main(String[] args) {             StringBuilder sb = new StringBuilder(“Shiv”);                           System.out.println(“Original String “ + sb);                             System.out.println(“substring: “ + sb.substring(0,2));             //  StringBuilder java.lang.StringBuilder.replace(int start, intend, String str)                sb = sb.replace(4,4,“!!!!”);                System.out.println(“replace String from location 4 to 4 charecters from location 4  “…

Read More Read More

String Demo

public class StringDemo {        public static void main(String[] args) {        String s=new String(“Shiv”);               char firstChar=s.charAt(0);        System.out.println(“First Charecter”+firstChar);               boolean status=s.contains(“i”);        if(status){               System.out.println(“i Found”);        }else{               System.out.println(“i Not Found”);        }        status=s.endsWith(“iv”);        if(status){               System.out.println(“ends with iv”);        }else{               System.out.println(” Not ends with iv”);        }        String newString=s.replace(‘v’,…

Read More Read More