Posts

Showing posts from September, 2017

Collections - Queue

Collections - Queue The java.util.Queue is a subtype of java.util.Collection interface. It is an ordered list of objects with its use limited to inserting elements at the end of list and deleting elements from the start of list i.e. it follows FIFO principle. Since it is an interface, we need a concrete class during its declaration. There are many ways to initialize a Queue object, most common being- As a Priority Queue As a LinkedList Please note that both the implementations are not thread safe. PriorityBlockingQueue is one alternative implementation if you need a thread safe implementation. Operations on Queue : Add()- Adds an element at the tail of queue. More specifically, at the last of linkedlist if it is used, or according to the priority in case of priority queue implementation. peek()- To view the head of queue without removing it. Returns null if queue is empty. element()- Similar to peek(). Throws NoSuchElementException if queue is empty. remove()- Removes...

Collections in Java -ArrayList

ArrayList in java  Arraylist  class implements List interface. It is widely used because of the functionality and flexibility it offers. Most of the developers  choose Arraylist over Array  as it’s a very good alternative of traditional java arrays. ArrayList is a resizable-array implementation of the  List  interface. It implements all optional list operations, and permits all elements, including  null . The issue with arrays is that they are of fixed length so if it is full you cannot add any more elements to it, likewise if there are number of elements gets removed from it the memory consumption would be the same as it doesn’t shrink. On the other ArrayList can dynamically grow and shrink after addition and removal of elements. Apart from these benefits ArrayList class enables us to use predefined methods of it which makes our task easy. Let’s see the ArrayList example first then we will discuss it’s methods and their usage. These are the main...

Java - Basic Syntax

When we consider a Java program, it can be defined as a collection of objects that communicate via invoking each other's methods. Let us now briefly look into what do class, object, methods, and instance variables mean. Object  − Objects have states and behaviors. Example: A dog has states - color, name, breed as well as behavior such as wagging their tail, barking, eating. An object is an instance of a class. Class  − A class can be defined as a template/blueprint that describes the behavior/state that the object of its type supports. Methods  − A method is basically a behavior. A class can contain many methods. It is in methods where the logics are written, data is manipulated and all the actions are executed. Instance Variables  − Each object has its unique set of instance variables. An object's state is created by the values assigned to these instance variables. This tutorials are made from best web development company in Bangalore .

Java tutorials

Java environment setup Local Environment Setup If you are still willing to set up your environment for Java programming language, then this section guides you on how to download and set up Java on your machine. Following are the steps to set up the environment. Java SE is freely available from Oracle website. You can download a version based on your operating system.Only the latest version of java would be freely available from oracle website. Follow the instructions to download Java and run the  .exe  to install Java on your machine. Once you installed Java on your machine, you will need to set environment variables to point to correct installation directories − Setting Up the Path for Windows Assuming you have installed Java in  c:\Program Files\java\jdk  directory − Right-click on 'My Computer' and select 'Properties'. Click the 'Environment variables' button under the 'Advanced' tab. Now, alter the 'Path' variable so that it...
ASP.NET compared with ASP Classic Now, I will differentiate the asp version between ASP.net and ASP classic. What are the changes in ASP.net instead of the ASP classic and what is the improvement from ASP classic. Besides, I am also focus on what are the new features in ASP.net. First of all, the mainly ASP.net difference from ASP classic is ASP.net is ASP.net is support more language for scripting. For example, Asp.net supports visual basic language, C#, C++, Jscript and ADO.net as well. Support multiple languages will getting more web developer choose ASP.net as their first choice to develop a web page and web applications and let different background programmer can work together by using a same application. Besides, there are few points to compare between ASP.net and ASP classic. One of the aspects is compilation. ASP classic is built up by Jscript and it only interpreted the Script line by line when the page is requested. Moreover, ASP.net compilation is totally different w...
Java as a programming language Java is one of many high-level programming languages that use abstraction (reducing and factoring details) to create software for computers and many other electronic devices. Compared to low-level programming languages, high-level programming languages use a mixture of natural language (any language used by humans) and typical computer terms to create an easier to understand and simpler form of programming. Figures 1 and 2 show the difference in writing a simple program called “Hello World” in Assembly (a low-level programming language) and in Java.  Like human languages, programming languages have different levels of writing difficulty; some are easy to write, while others require extensive computer knowledge to understand. In programming, high-level languages are easier to understand, learn and write because of the use of natural language. But, as the use of natural language decreases and more words and computer statements are added, the diffi...