Posts

Showing posts from May, 2017

WHY STRING IS IMMUTABLE IN JAVA

Here today I will Talk about the Two important Questions for the interview first one is. Why Strings are Immutable ?  What is the time Complexity of hash map ? The First One we take why Strings are Immutable ? This is the Question which is asked often why String is immutable ans is that in Java for String we have memory that is used is the String pool and a heap the heap contains the String pool. Now what is the use of String pool how it works is the other Question itself for the String pool as you write Srting str="abc"; By writing this what is the backend process .? By instantiating String and value Added is "abc" this is created in the  String pool just imagine that String pool is in the heap memory and it is a block in the heap memory a large block which contains storage of String literals i.e Constants. First of all when we Write String str="abc" it checks in the pool whether the "abc" type of Sting is present or

Vaadin Grid

Grid in vaadin is used to represent the data as we do in table in html so grid is the way to represent the  data in vaadin so mainly grid is a vaadin component. Grid has a header footer Row and Column to represent data . First of all to represent a data we need a data so that for that we can take a simple Array list. List <food> myfood = Arrays .asList(new food("maggie", 1), new food("pasta", 2), new food("pizza",3 )); // this we got the data to present Now initializing a Grid in vaadin same is the way as in ArrayList. Grid<food>=new Grid<>();// Taking Grid grid.setItems(myfood); // given here the array of Food grid.addColumn(food::getfoodName).setCaption( "Food Name " ); grid.addColumn(qty::getfoodqty).setCaption( "FoodQty " ); layout.addComponent(grid); grid.setSelectionMode(SelectionMode.MULTI);// can also add if we want select the multiple columns

perceptron in Artificial intelligence

Perceptron and perception are the two leading misconception that people often make perception is what the humans speak that is related to the natural language means how the humans percept. But perceptron is a different concept perceptron is related to what weights are decided are sent to training nets and further are finalized the correct weight. As you are famalier with the simulated annealing why it does that is taking an artificial neuron and counting the inputs based on the summation of weights of the total input's of each input say i and out can be either -1 or +1 based on the summation of weights whether it is more than or equal to 0 or less than 0 . So now you can underatand perceptron what is perception it is training nets we can say not actually or finalized weights but arbitrary weights that depends on 1. The actual output and the desired output 2. The input vector x  3. Ita that is the step size or the step gain . W(t+1)=w(t)+ita(d-y)x Here i

JAVA COLLECTION Framework

Image
Well anywhere in JAVA we need a help of Collections For say to access elements , to process the elements Looking forward to Collection we will see first the class hierarchy. Class hierarchy for Collection goes as follows At the First level we have an interface named Iterable the next that comes below Iterable is the Collection that means Collection Extends Iterable then comes List ,Queue,Set  So all the three interfaces at the Same level extends collection. Under   List  we have ArrayList, LinkedList as a class so they implement List interface we can say Now under sets We have HashSet, LinkedHashSet.                                         Now Moving On to ArrayList we will see the methods of iterator and collection method in between the concept of Array List in example. import java.util.* public Class myCollection { public static Void main(String args[]) { String s ; myCollection() { } mycollection(String s) { this.s=s; } ArrayLsit<String>

Vaadin Test bench Cases

Test bench cases vaadin 1.Initialize parameters 2.create Driver 3.Find the Element 4.Click() till the Desired State is Achieved 5 take a Snap Shot Test Bench uses Selenium to execute test cases in web browser We must Initialize the Driver by method Create Driver For that we must have to extend the test case with testbenchTestcase Driver is always set in a @before method Driver Quits in @after method @BeforeClass static public void createDriver() throws Exception { driver = TestBench.createDriver(new FirefoxDriver()); } @Before public void setUp() throws Exception { setDriver(driver); } ... @AfterClass static public void tearDown() throws Exception { driver.quit(); } } Next post we will see the assert methods and a test case example