Author Archives: Web Development Tutorial

Building Real-World App with ASP.NET Core and Angular 2

ASP.NET Core and Angular 2(4+) is an ideal combination for building real world modular and cloud-optimized applications. As we know that ASP.NET Core is a complete re-write version from Microsoft for building cross-platform applications.

Salary ranges for .NET developer in USA as reported by indeed.com given below but with experience in latest framework version i.e. .NET Core plus exposure to Angular 2 will definitely add more to it.ASP.NET Developer

ASP.NET Core:

ASP.NET Core 1.0 or ASP.NET 5 – MVC6 is a re-write version of ASP.NET 4.6 with following key features:

  • ASP.NET Core is Open-Source.
  • It’s a framework that is Cross-platform, means can run on Linux or MacOS. Before that .NET Framework (as a whole) can only be used in Windows platform. This is considered as a huge enhancement.
  • Ideal for building Web applications, Iot apps and mobile backends.
  • Cloud ready configuration.
  • ASP.NET Core 1.0 is smaller in size as compared to ASP.NET 4.6 framework as it runs on stripped down version of .NET Framework i.e. .NET Core 1.0.

Angular 2:

Angularjs 2 has most of the architectural component from previous version Angular 1.x such as Module, Directive, Service, Dependency Injection, Change Detection and Modularity. However, in Angular 2.0 existing all architectural building blocks from Angularjs 1.x are available in more better as well as improved format. The reason, some may argue that it is a completely new framework as it has shifted the coding to Type script. However, from architectural point of view Angularjs 2 is not a new web framework, rather, its just a better framework.

Quick and Easy Way to Learn and Build Real World Application using ASP.NET Core and Angular 2(4+)

In order to learn ASP.NET Core with Angular 2 by building a real world application is to join Mosh Hamedani (a 5 star rated author and trainer) at udemy.com.
Developing ASP.NET Core with Angular 2

ASP.NET Core because of its flexibility is preferred by several companies for application building. It is a recommended framework for both current and new professionals. Familiarity with .NET Core is not only helpful in securing job opportunities but also for progress in one’s current endeavor.

  • Build real-world applications with ASP.NET Core and Angular 2
  • Integrate ASP.NET MVC / Core with Angular 2
  • Implement a clean and decoupled architecture
  • Understand and apply the Dependency Inversion Principle (DIP)
  • Properly implement the repository and unit of work patterns
  • Use the new dependency injection feature in ASP.NET Core
  • Troubleshoot common runtime errors
  • Build APIs with ASP.NET Core
  • Test APIs using PostMan
  • Use AutoMapper
  • Store and retrieve data using Entity Framework Core (Code-first approach)
  • Implement CRUD operations (including one-to-many and many-to-many relationships)
  • Implement filtering, sorting and pagination
  • Handle and log errors
  • Display toast notifications
  • Implement photo upload with progress bar
  • Add authentication and authorization using Auth0 and JWTs
  • Write clean, maintainable and reliable code
  • Refactor bad code into good code
  • Better understand software development life-cycle

Take-This-Course
This course is overlooked by Mosh who has fifteen years of professional experience in software design. He is the author of several courses on Udemy website and has designed this course for real world application. He covers topics on building a real-world application using .NET Core, AngularJs and Entity Framework. The theory of the course includes the changes in the framework and the new tools of ASP.NET Core. Mosh focuses on teaching the core skills needed to build real world apps using ASP.NET Core and Angular 2+.

[UPDATE]: Added a new section to the course: Implementing Authentication and Authorization.

With over 4,000 students and 600+ positive reviews, this course is Udemy’s most popular course for learning ASP.NET Core in the context of a real project!

The course offered by Udemy to Learn ASP.NET Core and Angular 2+ focuses on building real world application instead of just theory. ASP.NET Core is an advanced version of ASP.NET which is a remodeled framework of the old version with modular, cross-platform and cloud-based support. The new ASP.NET applications run on all platforms without any support of virtual machine tools. This allows the users of Windows, Mac or Linux much more freedom and ease in building the applications.

Before going into details, let’s highlight few key points about this Course:

  • Best Seller Udemy Online Course
  • 4,527++ students enrolled
  • 665 Review available
  • 10 Hours on-demand videos
  • 14 Articles
  • 18 Supplemental Resource
  • Access on Mobile and TV
  • Certificate of Completion
  • Lifetime Access
  • 30 days Money back guarantee
  • You can get the course at Discounted Price here.

Most attractive feature is 30 days Money Back Guarantee means there is NO RISK. If you didn’t like this ASP.NET Core and Angular 2 Online Course, you can refund your money back within 30 days of purchase.

Take-This-Course

Requirement for the Online Course as per Instructor:

The course is designed for people who have had prior experience with.NET MVC 5 and are willing to learn the new version ASP.NET Core. It is meant to promote the level of coding and help learn ASP.NET Core and Angular 2+.

The prerequisites of the course are listed below:

  • Developers who have knowledge of ASP.NET MVC 5 looking to learn ASP.NET Core.
  • Professionals willing to learn to integrate ASP.NET MVC/Core with Angular 2.
  • Developers wanting to design an application from scratch.
  • Professionals looking forward to learning and improving their coding skills.

Student’s Feedback and Reviews:

Online Course Students Feedback

ASP.NET Core and Angular 2 Online Course Details:

The course covers the core topics and provides the necessary theory for understanding ASP.NET Core. The course provides hands-on experience by helping one build the application. It features an app design for a vehicle dealer which helps one learn the essential skills and build real world apps. In the term of the course one also learn integration of ASP.NET Core & Angular 2+ to make real world single-page applications (SPA’s). This course uses VSCode (Visual Studio Code) which is a lightweight cross-platform code editor and the command line to build the app.

The course also teaches one to NOT JUST build apps but also write quality code. Under the guidance of Mosh one learns how to write efficient code and also how to refactor the unnecessary code into clean and manageable code. The course helps you learn the skills essential to building nearly any real world project and think not just in technological terms but also as a software professional.

To take a professional approach this course covers following topics-

  • Building API’s using .NET Core.
  • Testing API’s with PostMan.
  • Integrating ASP.NET Core & Angular 2+.
  • Understanding and applying the Dependency Inversion Principle (DIP).
  • Properly implementing decoupled architecture with the repository.
  • Using the newly introduced dependency injection feature in ASP.NET Core.
  • Storing and entering data with the help of Entity Framework Core.
  • Implementing CRDU operations.
  • How to implement sorting and paging of the data.
  • Troubleshooting common runtime errors.
  • Handling and logging errors.
  • Implementing cascade dropdown lists, photo upload, and progress bars.
  • Adding authentication and authorization of several roles with varying privileges.
  • Displaying Charts, Dialog boxes, and Toast notifications.
  • Preventing CSRF attacks.
  • Implementing paging of the data.

Take-This-Course

Meteor Tutorial for Web and Mobile App Development – Part 2

Let’s continue exploring more in this series of Meteor Tutorial about Web and Mobile App Development. Part 1 of this series covers basics about Meteor including:

  • Installing and Configuring Meteor Development Environment
  • How to use ECMAScript Package, EsLint in Meteor App?
  • Collections in Meteor as well as different types of MongoDB Collections available in Meteor.
  • Define/Update Schema for Collection.
  • Read/Write to Collection.
  • How to connect to MongoDB Client?
  • View Rendering in Meteor App

Meteor Mobile App Development

Continue Understanding Meteor Web and Mobile App Development

What are Assets? How to use assets in Meteor?

Assets are normal resources on server. Assets API allow meteor application to access different resource in server side.

JSON File:

For example, if a Json file need to be used as a resource, that could be done as following:

Txt File:

Similarly, we can access any text file as following:

It is also possible to get the absolute file path of a static asset on server as following:

  • Each app has its own Assets object.
  • Currently, it is not possible to import Assets as an ES6 module.
  • Assets are accessible or called directly in any Meteor server code.
  • Assets are static server assets, located in the private sub directory of an application’s folder tree.
  • Assets are not application source file.
  • Assets usually copied to the app bundle.

Back to top

Making External HTTP request in Meteor

For example if we want to get data from the api called http://api.randomuser.me

  • Add  HTTP in order to make HTTP call
  • Add Method in server
    We need to add the following method in server/methods file as following:
  • Call getFriends method from the cardlist template as following:
  • Add cardlist Template as following:

Back to top

Communicating between Nested Templates

Take a look at the cardlist Template as following:

Here cardlist component has rendered card component in a loop and for each item in the loop it pass the friend variable as a parameter to card component/template.

As session is not been added the package so we need to add session to the app using following command:

Back to top

What is Atmosphere Package? How to use atmosphere package?

What is Atmosphere Package?

Atmosphere packages are developed specifically for Meteor and have several advantages over npwhen used with Meteor. From meteor 1.3, it has complete support for npm and the future plan is to move all dependency packages to NPM. However, currently both of the system are supported.  Although Atmosphere packages have certain advantages over NPM , such as:

  • Depends on core Meteor packages, such as ddp and blaze
  • Gives more control over assets management. It is possible to include non-javascript files including CSS, Less, Sass, Stylus and static assets separately.
  • Can help to structure code for both client and server, which make easier to deal with different behaviour in either server or client context
  • Get direct access to Meteor’s package namespacing
  • Supports package global exports without using ES2015 import
  • Can leverage the advantages of original Meteor’s constraint resolver
  • Directly access Meteor’s build system
  • Helps to use pre-built binary code for different OS, such as Linux or Windows

Source : https://guide.meteor.com/atmosphere-vs-npm.html

How to Write an atmosphere package and publish it?

  • Create Package
    The following command will create a new package with given name. Replace <package-name> with appropriate name. If the developer has a meteor developer username, <package-name> would be replaced with <username>:<package-name>
    Create Package in Meteor
    The above command will create a folder called ‘package’ inside the app’s packages directory, if the command has been executed inside an app. Otherwise, it will create a standalone folder called package. The file structure in the new folder would be as following:JSON Schema Generator
    The package.js file is the main file of each Meteor package. This JavaScript file describes related information about the Meteor package e.g. metadata, files loaded, architectures, npm dependency packages, and Cordova dependency packages. At the beginning the package.js file would be as following:Package JS FileHere api.mainModule(‘jsonschemagenertor.js’); is the main entry point for the package. all related functionality could be defined in  ‘jsonschemagenertor.js’ javascript file.  It is also possible to declare 2 entry point for server and client as following:
    Similarly, it is also possible to add other assets, such as CSS or SASS as a file, fonts as assents:
  • Export Package
    Now from the main Javascript file the package would be exported  as following:Export Package in Meteor
  • Install Package
    To install an Atmosphere package, run meteor add command inside the application:
  • Import Package
    To use an Atmosphere Package that has been created outside or inside the application in the meteor app it needs to be imported as following:
    Here username need to be replaced by the meteor developer username.
  • Publish Package
    From the package folder the following command needs to be executed:
    Here username need to be replaced by the meteor developer username.

Back to top

Writing a NPM Package for Meteor application

From meteor 1.3, it has complete support for npm and the future plan is to move all dependency packages to NPM. Therefore, it is possible to develop a npm package and use it in a meteor app.

Create NPM package

In order to create a npm package the first step is to create the package folder inside the node_modules folder of the project:

Here inside the app folder ‘mylibrary’, there is a node_modules for all npm package.  Now the following command needs to be executed sequentially:

If the package needs to be created outside meteor app as a standalone package, the following command can be executed in any root folder.

Publish NPM package

There are several steps to publish a npm package

  • Creating a npm user using ‘npm adduser’ command
  • Login using ‘npm login’ command
  • Ensure the user credentials are stored using ‘npm config ls’ command.
  • Finally publish the package using ‘npm publish <packagename>’ command

For comprehensive details about NodeJS and NPM, follow here.

Back to top

What is Reactivity? What are the Reactive Data Source? What is a reactive context?

What is Reactivity?

Reactivity is the mechanism of making the application alive. Therefore, in an application if any thing changes, the application executes some notification to let that no that some changes has happened.

For example, if there is a radio switch on the user interface that goes on to off based on the value of another variables saved in database.

Traditionally, if we want to solve this problem, there are several ways. Such as

  • There would be a timeout functionality that would query the value of the variable in the database, and every time there would be any change in the value off the variable, the functional wil turn on and off the radio switch on the user interface.
  • Another approach could be, using callback, therefore, every time there would be a change in the databse, there would be trigger to run the steps in order to get the new value for the variable.
  • In angularjs, there is $watch, which keep listening for the change of any variable and if it can detect any change it takes necessary action.

In all the above-mentioned way, it needs some dependencies or some process to be defined to make the application reactive.

In Meteor, there is a mechanism to provide reactivity in the application. Developer defines the function assuming there is no reactivity in the application, however, tracker take care of all the reactivity behind the scene. Therefore, there is no need for additional implementation for reactivity or change detection.

What are the Reactive Data Source?

There are a number of reactive data sources that could be used for making the application and reactive. Following are some example,

Session: Session is one of the mostly used reactive data source, any variable attached to the session is global variable and can be accessed anywhere in the application through accessing session object. Calling Session.get(<property>) will return the current state of the reactive property.

ReactiveVar: This is another reactive data source, the different between Session and ReactiveVar, is that it can be declared and used locally instead of defining a global variable in the Session. Anotehr difference is, it is a single variable.

ReactiveDict: This is a collection of reactive variable. Therefore, instead of creating a single ReactiveVar variable, ReactiveDict is a set of reactive variables reactive. Its like creating a collection of session global object, or local object, with its own name.

Cursor: In meteor app, Cursor is used for Collections and this is a source of reactive data.

Subscription: Ad meteor app supports Subscription enablement. Therefore, there are switch variable to indicate if the Subscriber can start invoking data. template.subcriptionsReady is a switch that takes the value true or false based on when the subscription becomes ready.

What is a Reactive Context?

In Angular application $watch is a reactive context. The functional of a reactive context is to keep listening for changes and as soon as it detects the change it takes proper action. In Meteor app, the reactivity context are Template helpers and Autorun.

Back to top

What is Reactive Programming? What are the differences between reactive programming and event based programming? How tracker enable reactivity for Meteor application?

What is a Reactive Programming?

On in any data driven web page , reactive programming is very important. It is necessary to track the changes in any data stream and update the page accordingly.

For example , if on a web page of shopping cart, it is necessary to show the summation of the product’s price, every time the customer add or remove a product to or from the shopping cart, the total price need to be changed accordingly.

In such use case, reactive programming is very useful.

The basic idea of reactive programming is to create a data stream from anything, the trigger point for a data stream generation could be a click event or even a hover event. The reason for creating a stream is stream can be of anything, e.g inputs, events, variable, collection etc. This data stream is same as the twitter tweet streams, any function can keep listening to it and can react accordingly.

Event based Programming Vs Reactive Programming:

The traditional java script application afe written using event based programming. For example, in case of an angular application,

Here shoppingcart is an object and there are a number of event handlers are registered with this shoppingcart object, every time the _totalPrice is set to a new value using setTotalPrice method it called changed() method and all the event handlers registered with this object are executed and their corresponding value of _totalPrice is updated. This is an event based approach.

However, in the following example, shoppingcart object does not have any method for changed or onchange. However, this shoppingcart object uses a new type of object which is Tracker.Dependency. This Tracker is updated any function that is referenced by it.

Therefore, the main difference between reactive programming and event based programming is that with reactive programming detecting change sin data is as same as subscribing to change notifications for the data without explicitly declaring any function which need to be returned every time the data is changed in case of event based programming.

What is a Tracker?

Tracker is just a small program (~1k) but it is very powerful library for transparent reactive programming in JavaScript. Tracker is a small program which acts as a simple dependency tracking system for meteor application which can rerun templates and other computations results whenever any of the Session variables, database queries, and other data sources changes. But the magic it it does not need to declare any additional onchange, changed or watch method as like traditional javascript platform.

Reactivity in Meteor is mainly performed using Meteor Tracker. Tracker is a core package which enables developer to use the concept from Functional reactive programming using some tracker-aware library e.g. Session/ReactiveVar/ReactiveDict.

For example, in the above shoppingcart example, if Tracker is used the autorun method which accepts a function that is reruned whenever any dependencies referenced by the function changes. Here in this example the shoppingcart.getTotalPrice() method includes a dependency defined by this._ totalPrice Depend.depend(); .

When the shoppingcart.setTotalPrice () method is called, the changed() of the Depedency is also called which ultimately call Tracker.autorun() to be retuned. Tracker.autorun() method is always listening to the changes to the data, therefore, it need not to be triggered additionally, it is automatically triggered whevenr any changes occur to the data.  In summary , Tracker.autorun()  method run a function passed as argument now and rerun it later whenever its dependencies change. Tracker.autorun()  method  returns a Computation object or result that can be used to stop or observe the rerunning.

How to use Tracker in an Application?

  • Add meteor library using the following meteor command

  • Make sure the library has been added to the application successfully. Open console from browser and test the following lines, if the changes are followed correctly, the library installation is successful.

  • In More details , tracker has been implemented using the Observer pattern. For exmaple,

Back to top

Best designed course online for iOS & Swift by Mark Price who is an experience Mobile App Developer, developed many Mobile Apps for iOS and Android platform. He has also developed many Unity 3D games including Call of Duty Ghosts mobile.

Before going into details, let’s highlight few key points about this Course:

  • Declared Best Seller Online Course at udemy.com
  • 48,130++ students enrolled
  • 8,745 Review available
  • 71.5 Hours on-demand videos
  • 14 Articles
  • 59 Supplemental Resource
  • Access on Mobile and TV
  • Assignments
  • Certificate of Completion
  • Lifetime Access
  • 30 days Money back guarantee
  • You can get the course at Discounted Price here.

Most attractive feature is 30 days Money Back Guarantee means there is NO RISK. If you didn’t like this iOS 10 and Swift 3 Online Course, you can refund your money back within 30 days of purchase.

More details…

How to enable login using twitter, facebook, google, or email in meteor application?

The steps in order to enable login from other application in meteor application are as following, for example, here we would use twitter login:

  • Set up the corresponding app library  by running the following command:
    • Facebook
      accounts-facebook package enables user account authentication using Facebook account.
    • github
      accounts-github package enables user account authentication using GitHub account.
    • google
      accounts-google package enables user account authentication using Google account.
    • twitter
      accounts-twitter package enables user account authentication using Twitter account.
  • Next step is to add service configuration
    service-configuration package is used to configure connection to the various third-party services e.g facebook, twitter etc.
  • Add email packange to enable sending email from the server using the nifty Email.send method.
  • Create settings.json file in the root directory. In order to enable different deployment environment, it is recommended to create two files such as settings-development.json and settings-production.jsonCreate Settings JSONSettings.json file will list all the secret token for differnet registered application on third party application, e.g. facebook, twitter etc. This secret key would be available if the application is registered.
  • On starting the application run the following command:
  • Add the following code to server/index.jsMeteor Startup Configuration
  • Create class to call Meteor method to login with twitter

Back to top

More Mobile App Development and Related Articles:

MUST Have Core Java Interview Questions – Part 3

We are continuing with Part-3 of MUST Have Core Java Interview Questions and Detailed answers tutorial. Major topics covered in this Java Tutorial are Garbage Collection in Java, File Handling and Java I/O, Generics in Java, Hashmap details and performance improvements in it.

Java Interview Questions and Answers

Complete Java Interview Questions List

Udemy

Explain garbage collection with example? What are different parameters to tune GC?

Garbage collection is most important and most critical part of JVM. Whenever we create any object it is created on the heap area. When these objects keep on creating in the heap area, heap gets full and whenever on the full heap VM tries to put a new object, it does not allows and throw error.

This is same in C,C++ as well, where we need to remove the object or clear the space manually and need to create destructor to finalize object.

Java takes this part a step forward and provides garbage collector which automatically collects the unused objects and keeps heap space happy. So programmer while writing program needs not to worry about the object destruction part.

Java provides automatic garbage collection, and it just removes the objects that are not reachable anymore.

There are two kind of object state in Heap :

Reachable, these are the objects that are referenced.

Unreachable, there are the objects that are not referenced from anywhere.

Below is the diagram how the heap is divided:Garbage Collection Java Tutorial

This is how the head is divided into regions.  There are basically two regions in heap, these are Young Generation and Old Genearation.

Lets talk about both of them brief:

Young Generation : As the name suggests, young generation is the space where once the object is formed, it is placed in. Young generation is further divided into two regions that are Eden Space and Survivor Space. Eden space is the space where all the fresh or new objects are placed, once any new object is created with new, it will be placed into Eden space. We will talk about GC strategy afterwards but when GC cycle runs and any object that survives one cycle are moved to Survivor space and in Survivor space these objects are keep moving from one to other from each GC cycle. Some objects that became unreachable are garbage collected and some objects who are still reachable are exists in the survivor space.

Old Generation:  Old generation again as the name suggests where old objects are placed. So we have talked about the survivor space in young generation. Objects that are survived more than a threshold that is max tenuring threshold are moved to old generation.

Below is the GC parameter for this threshold:

Whenever any object crosses the number that is given in MaxTenuringThreshold, the same object is promoted to Old generation.

There are GC cycles as well, they kicks in when JVM sense low heap memory.

Minor GC Cycle is GC cycle that run periodically and collects the unreachable objects.  Whenever there is memory crunch and there is low memory then GC triggers major GC that runs on whole heap and collects the objects that are unreachable.

If your JVM continuously kicks major GC then there are possible chances of memory leak. In this case one needs to check application and find out the possible memory leak.

There are different kind of Garbage collectors available and we can use any of them with our application.

  • Serial Collector : Serial garbage collector is a garbage collector which runs with single thread and the same can be used for small applications.
  • CMS : CMS stands for concurrent mark sweep garbage collector. In this kind of garbage collector JVM continually does mark and sweep on the objects that are in the heap. This runs along with the application. One more thing about this garbage collector is that it doesnot stops the world, it just stops the world on mark/remark process. When we say stop the world it means that the application will be paused for a small amount of time.
  • Parallel: Parallel garbage collector is a garbage collector which uses multiple CPU’s to garbage collect from heap. Uses multiple CPU’s to mark and sweep. This garbage collector stops the world when it runs.
  • G1 : G1 stands for Garbage First, Introduced in java 7, this garbage collector divides the heap into small small regions. Regions with most garbage will be collected first.

There are different VM arguments to select the respective garbage collector:

For Serial GC:

For Parallel GC:

For CMS GC:

For G1 GC:

Back to top

Explain file handling in java, explain I/O in java, with example?

To deal with file system, java comes with I/o package, which provides a very rich library to interact with any of the file system. I/O basically stands for input/output. Java provides functions that deal with file system, whether creating a file, reading or deleting.

Lets talk about term Stream, that is very widely used term when we talk about i/o in java. So what is stream in java? Stream is basically a sequence of data that will be either reading by our program or our code will be writing, with is in a way input / output operation.

There are abstract classes present different kinds of stream that are ByteStream and CharacterStream. We will be using these classes when writing our code for input/output handling.

For ByteSteam java comes with InputStream and OutputStream, whereas for CharacterStream java comes with Reader and writer classes. For reading out of file system java comes with InputStream, whereas for writing OutputStream is used. For optimization BufferedInputStream and BufferedOutputStream are used.

Below is the hierarchy diagram of I/O classes:File Handling in Java

So this is how the file system hierarchy goes. Dotted one means there are multiple implementations but we have listed some of them. You can go through the java doc for all specification. But these are the implementations which are most widely used while dealing with file system.

Lets write code for creating file and write some data over it:

Lets understand the code first and then try to run and see what happens. What we have done is we first created File object and created a new file in our system. Once we are done with creating new file, we have to write some data in this. For this purpose we have used BufferedOutputStream, since as we have discussed earlier as well, BufferedOutputStream is optimized way while we deal with file system. After that we just write byte array to output stream which will actually write the data to our file system.

Lets run the code and try to find if it working fine:TempFile in System Path

So as we can see tempfile has been created in the given system path. Lets open and see if it containes the data that we have passed:Java TempFile

Allright, so we got the data what we wanted to write in the file. This was a very simple example of how to write data in a file using I/O library in java. In the same way using FileInputStream we can read the data from file system as well. Apart of these i/o library has a lot of methods to deal with file system. This is all about file handling in java using i/o library.

Back to top

Explain generics in java with example?

From java 1.5 a new concept is emerged that was generics and from then this was used very heavily in all types of applications. What was so special in generics and what does it solved. Lets understand in this section.

Basically generics provide some very useful features like type safety. Type safety is some thing which was not there in java before java1.5, type safety is a concept which says there is only and only one type of object is allowed in collection.

For example:

In the above example only String type of objects are allowed in this collection. If one tries to enter any object other than String complier will throw the error.

Here one more important thing of generics comes that is check at compile time and not run time. And this is another good thing which is these small types of thigs are detected at compile time and not at run time.

If one tries to add integer or some other object compiler will throw error and it is not allowed to do.

What if one tries to create a Generic class, let’s try to create on:

So we have created a simple generic class with set and get the object. To create one we need to modify the class signature what we usually writes, and append a generic object term to it, in the example above we used it as T. T is the type of object what we will try to set and get from our main class.

Lets create our main class and test if our Generic class working fine:

Executing the above code we got the output as:Generic Classes in Java

So we got what we set with the Generic class’s setObj method.

We can use generics on the method level as well like we used on class level.

Subtyping is not allowed in generics. Like we can not use subtype while declare with generics. Like we can not use Object and String as subtype in generics. For example:

Writing the above line, compiler will complain and the code will not compile. Lets try to run and see what the above code will throw exception.MainGenerics in Java

Running the code will throw the above exception. Irrespective of String is subtype of Object, but the compiler will not allow to use the sub types in generics.

Back to top

Explain HashMap in detail, what are performance enhancements in HashMap in Java8?

Hashmap is a special kind of collection in java and why we use special kind of collection with HashMap is because unlike other type of collection, HashMap provides key, value pair type of collection which other collection doesnot provides.

HashMap works on concept of hashing. One thumb rule is while working with hash based collection is that when writing custom classes and use them as a key in HashMap, we should always override HashCode and equals methods.

And why these are important is because, based on the hashcode, there is one more method in HashMap class which again calculates hash for the object, just to prevent against poor quality hash code methods.

Below is the implementation of hash method from HashMap class:

As we can see, object’s hash code is used again in the HashMap class.

Based on the hash, bucket is defined, on which the object will be placed. So there are buckets which are simply an array. Index of array is calculated based on the hash value and based on the index the values are placed in the bucket.

One more important thing to learn is Entry class, Entry class is an inner class in HashMap, code of Entry class is as follows:

So we have just added a glimpse of Entry class to understand what this class does. There is a lot of code in this class, that you can found in the HashMap class itself.

So basically bucket has Entry objects. Entry class is basically a LinkedList, if you see there is a next variable in the class which contains the next pointer. Apart of this there are key and values that HashMap stores.

So why this Entry class is designed as LinkedList?

What we understand earlier is that, based on the hashcode that we have defined in our object, the index is calculated and based on the index the object is placed in HashMap. Now suppose, for two object same index is calculated. If there is same index and if there is already an object is placed in the bucket then will it be overrided ? No, because the Entry class is designed in such a way that if there are more than one object on the same index then these will be added in the Iinked list.

This is because the Entry class is designed as LinkedList.

Now Lets see code for put and get methods in HashMap class.

So as we can see in put method, hash function is used to generate hashcode and the same hash is used to get the index for the bucket. One more thing, there is only one null key allowed in HashMap and the handling for the same can be seen in the method.

Lets see code for get as well:

So here we placed code for getEntry, which is been called from get method of HashMap. Here as well same as the put method, hash function is used to calculate the hash and based on hash the bucket is decided and based on bucket the Entry is fetched.

If you see the code of put and get closely then you will find the importance of equals and hashcode methods . And why it is very important to have them in the object that is being used as key in HashMap.

Now lets talk some about performance now, suppose there is very bad hash code designed and that returns the same value each and every time. In this case the bucket location of all objects will be same and the linked list will keep on growing. And once the the linked list grows then to retrieve the element is difficult because the complexity will be O(n) at that time. So what performance improvement being done as part of java8 is that whenever the linked list grows about a threshold the list is converted into a tree, and tree is red black tree, we will not go in the details of redblack tree but certainly the performance improvement will be there. Since the complexity of tree traversal is O(logn) . That is the performance improvement done as part of java8 in HashMap. This is all about HashMap in java.

Back to top

This Java Tutorial Series is continued and you can find more Java Interview Questions and answers in coming Web Development Java Tutorial here.

More Technical Interview Questions and Answers Series:

Udemy

How to become a Game Developer using C# and Unity?

Web and Mobile Game Development

The process of generating an image from 2D or 3D model is known as rendering. Rendering plays an important role in game development. The process of creating a video game is all about creating a 2D or 3D video using the rendered images. In a 3D game, the code gets complexes, requires the high level of math skills, and also accurate resources. The C# and Unity 4.6 or 5 helps in creating 2D or 3D games with less complexity and easy techniques.C# Unity Developer

C# as a strong programming language can be used for coding the actions for different modules of the game. The language is integrated and is easy to understand for the beginners. Moreover, the language is programmable and compatible with 2D and 3D games.

Unity is a 2D/3D game engine which allows the user to design the game with all the necessary tools. It is well established and stable game engine which enhances performance, optimization, and modifications. Unity allows to design game in an environment which is friendly and easy to understand. Unity has various components which allow the user to import objects or projects from various sources.Multi-player Mobile Gaming Apps

The Quick and Easy Way to Become a C# Game Developer using Unity Engine

It’s always interesting to learn a language skills by making funny things. An Online Course by Ben Tristem really made it fun to design and develop Video Games using C# and Unity. If you take this C# Online Course, it will make your learning experience with C# enjoyable and creating something amazing.

Online Course prepared to design and develop 2D and 3D Video Games a fun by Ben Tristem who is an experienced Game Developer, Best-selling Instructor and Online Entrepreneur.

Before going into details, let’s highlight few key points about this Course:

  • Best Seller Udemy Online Course
  • 162,868++ students enrolled
  • 22,275 Review available
  • 46 Hours on-demand videos
  • 16 Articles
  • 39 Supplemental Resource
  • Access on Mobile and TV
  • Assignments
  • Certificate of Completion
  • Lifetime Access
  • 30 days Money back guarantee
  • You can get the course at Discounted Price here.

Most attractive feature is 30 days Money Back Guarantee means there is NO RISK. If you didn’t like this C# Game Development with Unity Online Course, you can refund your money back within 30 days of purchase.

Requirement for the Course as per Instructor:

  • Unity 3D capable Mac or PC.
  • Unity 4.6.3 for initial content, free from Unity.
  • Unity 5 for more advanced content, also free.
  • Blender, free from http://www.Blender.org
  • Coding experience is preferrable or you will learn along the way with him.

Student’s Feedback and Reviews:

This Online Course has maintained an average rating of above 4.6 by 162,868+ students which I believe is the highest by any course by such a big number.C# Game Development Review

We’ll strongly recommend to go through the course and instructor reviews and see how people are taking benefit and learning Game Development easily.

Overall, this course is fantastic.

I believe you will find this course to be one of the best and most thorough options available to learn about Unity. It is engaging, entertaining, and informative. The instructors generally do a great job presenting both basic and more advanced material in a logical order that neither talks down to you nor makes you feel overwhelmed. The breadth of the course is simply stunning, with over 50 hours of video, seven different games (sort of; see below), coverage of PC/Mac, web, and mobile, and inclusion of related topics like revision control and testing.

In short, and if you don’t want to read the rest of my review, my feedback is very positive and I highly recommend this course. View Complete Review.

by Chris Derossi

More reviews can be found here.

C# Game Developer Online Course Details:

Although, it’s thorough and very extensive course on game development but we have highlighted few key aspects of this courses here but still recommend to go through the detailed curriculum to see all details.

Before you decide to TAKE or NOT TAKE this course, it’s recommended:

  • To watch the freely available preview videos for many lectures. It will help you understand that how your instructor is delivering the real value? as well as the in-depth knowledge you will be getting.
  • Go through the Reviews given by the actual students of all categories (means who given 5, 4, 3  or even 2 star) to understand the plus and minus areas of this online course. Although no one out of 162,868+ students gave 1 star rating so far.

What this Online Course Includes:

  • Installation and Setup
  • Basic Scripting
  • Text Adventure
  • Number Wizard UI
  • Block Breaker
  • Laser Defender
  • Glitch Garden: A Plants Vs Zombies Clone
  • Bowl Master: 10 Pin Bowling
  • Zombie Runner FPS
  • Twin Stick 2.5D
  • Ahoy Matey RTS
  • What’s Todo Next

What this Online Course DOESN’T include:

This online course covers many required areas related to Game Development. Few advanced areas are not included in this course and those are:

  • Performance optimization.
  • Editor plugins or modifications.
  • Physics engine modification.

** There is a separate mini course available for advanced topics including above topics.
Take-This-Course

MUST Have Core Java Interview Questions – Part 2

Let’s continue with Part-2 of MUST Have Core Java Interview Questions and Detailed answers tutorial. Major topics covered in this Java Tutorial are Exception Handling in Java, Threading in Java and Synchronization, Access Modifiers and usage, thread pooling in Java, Complete Collection Framework and Inner Classes.

Java Interview Questions and Answers

Complete Java Interview Questions List

Courses Online

What are different kind of exceptions in java. Explain Runtime and complie time exceptions ? Explain try,catch,throw,throws,finally with example.

Exceptions start from the base class Throwable. Throwable has two hierarchies one is error and other is exceptions. An exception further has its own hierarchy and furthermore divides into Runtime (Unchecked) and all exceptions other than this runtime exception falls into Compile (Checked) exceptions.Exception Handing in Java

As we can see in the diagram above Throwable is the parent class from where all exception propagates. Error is basically an unwanted scenario in the code which will occur and the system will been able to recover from this. Like stack overflow or the heap dump error, which are not recoverable. On the other hand exceptions are the scenarios where in our system will be able to recover from it. I.e. we can handle these types of scenarios in our code.

Lets understand each of them with example.

Runtime (Unchecked) Exception:

Runtime exceptions are basically programming exceptions, which will occur during run of program. Lets say we are writing some mathematical programming code where we are have function which take two parameters , one as dividend and one as divisor.

So we are taking parameters form console and passing them to the divide function, which divides and returns the result. By mistake someone has sent the divisor as zero. Ideally one should not send zero as divisor.Runtime Exceptions in Java

So we send two arguments as 12 and zero, lets run and see what we see in output.Output for Exceptions in Java

So we got divide by zero exception, which we got when we try to run the code with the arguments, we got the divide by zero exception, which is a kind of runtime exception in java. So in essence we got runtime exception when we try to run the code with wrong arguments and we don’t have any try/catch block.

Compiletime (Checked) Exception:

Checked exceptions are the exceptions which are occurred during compile time of the code. For example we are writing code where we are dealing with I/O. Some of the methods of File api throws exception which we need to handle in our code, if we don’t add handing for these exception by throws in the method signature or adding try/catch in the code fragment, our code will not compile. Lets take an example where in we will using the File api and we add the code from which we don’t have the handling for the thrown exception.

Now if we try to compile the code using command prompt, it will not compile. If you are coding using IDE, the IDE will suggest us to handle the exception and mark this line of code as non-compliable. Lets try to compile the code using command prompt and see what happens:Compile Time Exceptions in Java

As we can see when trying to compile the code, compiler is explaining about the exception must be caught or declared to be thrown.

Lets talk about few keywords that are used in exception handling in java.

Try/catch: try/catch is used when there is possible exception in a code block and an exception is been thrown out of it or an exception can be occur out of this code block. In these kind of scenarios we use try/catch block. There can be multiple catch blocks with a try block, but the thumb rule is that exception can not be narrow down in the subsequent catch block. Example of try/catch block is below:

throw/throws:

throw/throws is used when in a method we want to indicate the calling method that the code is throwing some exception. Throw used mostly when we want to wrap an exception to a particular kind of user defined exception.

Finally:

Finally keyword is used when we want to do some particular kind of task even after the exception is thrown out of the code. Finally code is always executed, except some particular scenarios where we use System.exit in any of the catch block.

Back to top

How to create thread in java, what are different ways to create a thread? Explain synchronization with example.

To create thread in java, there are two ways:

  • By extending Thread class
  • By implementing runnable interface

Let’s understand the same with example:

In the example above we are creating thread with both extending Thread class and also implementing Runnable interface. We have created a class PrintThread which is extending the Thread class and in the run method we have printed a string. On the other hand we have also created  class PrintRunnable which is implementing runnable interface and we have overridden the run method of this interface and in the run method we did some dummy text.

If you see the code thoroughly, in the main method where we have instantiated both Thread, the class with is extending the thread class we have created direct object, since it is extending the thread class, where as the class which is implementing the Runnable interface, we have created a Thread object and passed Runnable object to it.

One we are done with the initiation part, all we need to do is to start the threads.

Upon running the code what we got as output is:Threading in Java

Synchronization in Java:

Synchronization is the concept of acquiring lock on an object. In java each object has a lock and to acquire the lock on an object we need to use a keyword that is used for this purpose only, that is synchronized.

By using this keyword we can acquire lock on an object, the scope of lock can be on method or on a particular piece of code.  It is always advisable to lock a particular piece of code instead of locking the entire method. Since if there will be lock on the method level then all objects will be kept on waiting stating until unless the running thread does not completes its task.

A part of synchronized keyword, Lock api does the same task. So we can use Lock api as well instead of synchronized keyword.

Back to top

What are different access modifiers in java, explain with example?

Access modifiers are the modifiers which provides access/visibility to class, method, field.

In java there are four access modifiers :

  • Public
  • Private
  • Protected
  • Default

Public access modifier provides object visibility to anywhere. Any object can access public class, public interface from anywhere. When we are saying anywhere it means from any class from any package. Public access modifier can be applied on class, methods, fields , constructor, interfaces and inner classes.

Private access modifier provides object visibility to no-where, other than the class. It is just reverse of public access modifier. Private access modifier can be applied on methods, fields, and constructor and inner classes.

Protected access modifier provides object visibility to same package or any other package where the class is been sub classed. Protected access modifier can be applied on methods, fields and constructor.

Default access modifier provides object visibility to same package only. Default access modifier can be applied on class, methods, fields, constructor and inner classes.

Lets check the same with some code stuff. We will be creating two packages to check the access, also we will add one class with four methods with four different access modifiers and we try to check how the visibility goes.

Lets start with creating CheckAccess class which has four methods with all four modifiers.

Lets create a Main class and try to access these four methods.

So we have added all four methods, lets try and run the code.

Upon running the code what we got is:Private Access Modifier in Java

So we got exception, since doCheckPrivateAccess has the private access modifier and doesnot have visibility to outer class other then the class itself where it is declared.

Lets test the same with other package. So we will be creating the same main class in other package and try to run the code.Main Check Access

So as we can see other than method with public access modifier, no methods can be accessed in this class which is other package. So it is as expected, now check for protected modifier which are accessible from other package where class is sub classed. Let’s modify our code and check:

Upon compilation of this code what we got is:Java Access Modifiers

Only public and protected modifiers have visibility in this class. Public one because public has visibility all over and protected because protected access modifier has visibility in same package and other package where it sub classed.

Back to top

What is thread pool in java? Explain executor framework with different types of thread pools in java?

Thread pool, as the name suggests, it is a special kind of pool that maintains threads. Thread pool keep threads alive and not let them die. Whenever a task needs a thread, thread pool fetches the thread from thraedpool and allocates to task. Thread does its task and again comes into the pool.

So we are talking about die of thread, what is that special thing in thread that don’t keep threads to die. Or if we take the same in other way, when a thread dies. When we call thread has completed the task and it is no more alive now.

So we are talking about the run() method of thread. This method is responsible for keeping the thread alive, when a thread exits from the run method it is died. What thread pool does specially is that it don’t get the thread exit from the run method. This is so special about the thread pools.

To create thread in java is not an easy task behind the scene for vm. What thread pool does specially for vm is it just removes the extra thing that vm needs to do for creating threads separately. In java there is something called executor framework, which provides some special kind of thread pools. Using the executor framework the same can be achieved.

Let’s talk about the thread pools that executor framework provides. There are four kind of threadpools in java:

  • Fixed Size Thread Pool
  • Cached Thread Pool
  • Single Thread executor
  • Scheduled Thread Pool

Fixed Size Thread Pool

Fixed size thread pool is a thread pool, where a fix number of threads are available. Whenever any task arrives it is been allocated to a thread whichever is free at that point of time. If no thread is free at that point of time the task is kept on waiting until a thread is free. If any thread dies during run, then it’s executor functionality to ensure that the thread will be created.

Signature to create service with this kind of thread pool is:

Here 10 is number of threads that we want as part of this service. These can very as per requirement.

Threads in this thread pool dies once shutdown() is called, till then all threads in the threadpool are kept alive and they keep picking tasks.

Cached Thread pool:

Cached thread pool is a thread pool, where threads are kept in cache and they are created as and when needed.  If there are threads available and a task arrives then the threads are reused. Once a thread is done with the task then the same thread is kept into the pool. In order to make is more efficient and less resource consumption, the threads in pool are terminated after every 60 seconds, which are idle.

Signature to create service with this kind of thread pool is:

This piece of code will create an executor where threads will be created as and when needed and idle threads will be terminated after a minute.

Single Thread Executor :

Single thread  executor is a thread executor  where exactly one thread executes a task. So it is guaranteed that one task will be executed at one point of time. If any task arrives when the executor is executing a task, then the arrived task is kept in a queue and as soon the executor completes the running task, new task got picked and is executed. This kind of thread pool is used when tasks are required to run sequentially.

Signature to create service with this kind of thread pool is:

The above line of code will create an executor with a single thread.

Scheduled Thread Pool :

Scheduled thread pool is a kind of thread pool where threads can be scheduled to run at certain amount of time. Threads can also be triggered to run at certain period. In this case threads will run at a certain period.

Back to top

Continue with Java Interview Questions Preparation

What is collection framework, explain collection hierarchy? Briefly explain List, Set, Map, Comparator and comparable.

Collections in Java

Above is the diagram of collection framework. Collection interface sits on the top of the hierarchy, below this there are interfaces like List, Set, Queue that extends this Collection interface.  Below this in hierarchy are the Classes that implement these interfaces. Like ArrayList, LinkedList etc classes implements List interface. Whereas Hash Set etc classes implements Set interface. LinkedList, PriorityQueue implements Queue interface.

Interesting to see there is no Map interface in this hierarchy, isn’t it ? Map interface has its own hierarchy, and the reason behind it that Map works on key, value pair rest all collection classes works on value part only and not key value.

Let’s see how Map hierarchy goes: Map Heirarchy in Java

As we can see in the diagram, classes like HashMap, HashTable implements Map interface, since Map stores in key, value pair and not only the elements.

Lets start with List interface :

Whenever one wants to store elements in ordered sequence, that can be accessed based on index or based on iteration, List interface is used there. List maintains the insertion order and retrieval on list is also based on the iteration of the list. List store any type of objects and based on the object type if it is primitive List automatically box unbox the primitive data types. One more property of list interface is that list allows the null and duplicate elements that are not allowed in some of the data structures that we will talk later on.

Most common and most used implementation of list interface are LinkedList and ArrayList.List Interface in Java

The above are the methods available in list interface. Implementation of the same can be found in each and every implementation of List interface.

Lets move to set interface:

Generally we use set where we want no duplicate elements, HashSet is most common implementation of Set interface and most widely used.

Set has the property that is does not allows any duplicate elements, one null element is allowed but not more than one null element.

One more important thing to keep in mind is that, whenever we are using any custom object in Set, we must override the equals and hash code methods from object class these are utter important when dealing with the hash based collection.

Let’s now move to Map interface:

Map interface is used when we want some key value kind of relationship. This is the only reason that map does not fall into the standard Collection hierarchy. Since if you can see all the implementation of the Collection interface have only the value part and none of them has the key value mapping. So what if one needs key value mapping, here Map comes to rescue, Map provides key value mapping of the objects.

As we talked in the Set part, while dealing with Maps as well one must override the equals and hash code methods from object class and provide the implementation accordingly.

Whenever one dealing with sorting of collection, Comparable and Comparator are the collection that we needs to use. Both are used for sorting of the underlying collection.

It is all about the collection interface in brief.

Back to top

Explain are Inner classes in Java? When will you use an Inner Class?

Inner classes as the name suggests are the classes within classes. So there will be outer classes and inner classes concept. Inner classes will always be a part of outer class and they will be enclosed in outer classes.

Inner classes behave much more similar to a method in a class or a field in a class. Like there are members of a class same as inner classes will also be part of class within which the inner class in enclosed.

Usually we should avoid to use inner classes because class within a class and to read such kind of code is a bit hard, inner classes are good to write but at the same time they make your code less readable.

Also to maintain the code with such properties is not an easy task, like if there are some modifications in the class than one should have the full knowledge about the class how it was written and what the inner class in is has intended to.

Lets take an example of inner class:

So we have created a class named Employee and there is an inner class called Department. Outer class have one field name and inner class also have one field id that is of type integer.

Lets see how this class can be used.

We will be creating a main class and we will try to use this class:

This is how the inner class can be used. As we can see the Department class is property of Employee class then the Department will be accessed can be only accessed with reference of Employee class only.

There is one more concept as well to create anonymous inner classes, let see how to create and use them.

This is how inner classes are created and used in java.

Back to top

This Java Tutorial Series is continued and you can find more Java Interview Questions in next Web Development Tutorial here.

Top Technical Interview Questions and Answers Series:

Hybrid Mobile App Development using Ionic and Cordova

Ionic is basically an open source SDK (Software Development Kit) for developing Hybrid Mobile Applications. It’s a front-end UI framework built on top of AngularJS and Apache Cordova, providing tools and services to build Hybrid Mobile Applications with native look and feel.Ionic Mobile App Development

Step by Step Ionic Mobile App Development

You can follow the below steps to create your first Ionic Hybrid Mobile Application:

Step 1: Install Ionic

Running the following command will install ionic and cordova

Note: Angular 4 is out now. We can use Angular 4 to develop applications that are cross platform with maximum speed and performance. More to learn Angular 4 here.

Step 2: Creating and Running the App

In order to create an ionic app with ionic 2.0 framework,  we have to run the following command on the workspace folder of the project. For this example the name of the project is ‘mytodo’ . –v2 is used for Ionic 2.0 . Ionic 2.0 is based on Angular 2.0.

There are currently three different layout are available for ionic 2.0 app.  In above command to create an app it is possible to mention the template or layout for the project.

On running the above command we can see the following output on command prompt:Ionic Mobile App

It will also asked for creating a free account:Simulator for Mobile App Development

The following files would be generated inside ‘mytodo’ folder:Hybrid Mobile App Folder

Enter in to project root folder using following command

Step 3: Updating Metadata

Open www folder and add this security meta tag to index.html file:

Step 4: Installing Cordova Plugin

From the project root folder run the following command in order to install the cordova whitelist plugin:

Cordova Plugin

Step 5: Run the Project

Run the project with following command:

This will open a new browser window and the output would be as following:Ionic Menu Starter

As for example, we have selected the Layout with side menu. On clicking on the ‘TOGGLE MENU’ it will show the following screen:Mobile App Menu

Initially there are two pages and and two menu items. The source code would be generated for corresponding pages as following:Ionic 2.0

Ionic 2.0 is modular and component based. Therefore, there would a single module called AppModule in src/app/app.module.ts file. In addition, for each page, there would be a corresponding component. For example, in this example, there are two component page1 and pag2. Each of the component folder has its template in  .html file, styles in .scss file and component class in .ts file.

It needs a component as the parent component for the append that will be boostrapped as soon as the module would be bootstrapped. In this example, MyApp Component has been defined in src/app/app.component.ts file as following:

Finally each component has been declared in App Module as following:

The above command will create a new component with name page3 Ionic Component

And one more time run the same command:

Add the pages to the menu item in app.component as following:

Add the new component in the declaration of the AppModule

At this moment the App would look as following:Basic Ionic Mobile App

It’s just a basic Ionic Application but you can follow here to find lots of details about Ionic Framework Concepts and getting answer for many related concepts/questions including:

  • Navigation in Ionic 2
  • How to publish an Ionic Application?
  • Developing a user defined pipe in Ionic Application
  • How to Cache  View?
  • Making HTTP Request from an Ionic Application
  • and much more…

More Mobile App Development and Related Tutorials

The Complete Web Developer Course 2.0 – Review

Increasing demand for web developers with attractive salaries and flexibility geographical locations makes it an attractive profession. As per careeronestop.com, location-wise employment trends are ranked by % growth for web developers.

Demand for web developers is expected to increase by various types of companies across different states of U.S as follows (We can see that demand is increasing in almost all US states for web developers till 2024 with an average of 26.6% overall) : Web Developers Jobs Trend

Although demand for web development in each area is increasing but full stack web developers will definitely get more opportunities as compared to front-end and back-end web developer. Following is Job trend from Indeed.com for Full Stack Web Developer.Full Stack Web Developer

Web development is a very vast area and there are a lot of things to learn for and we keep learning as we move forward in web development. Sometimes new frameworks, sometimes new language updates and so on. Good thing about this course is it covers almost all important areas and make you a full stack developer.

Following key skills related to web development is covered in this Online Course:

  • HTML5
  • CSS3
  • JavaScript
  • jQuery
  • Bootstrap
  • PHP
  • MySQL
  • APIs
  • Mobile Apps
  • WordPress
  • and more…

We’ll strongly recommend to take an Online Course by Rob Percival that covers almost each and every concept related to web development. We have given a detailed review of this course below for our readers but just wanted to highlight some points:

Before going into details, let’s highlight few key points about this Course:

  • Best Seller Udemy Online Course
  • 255,870+ students enrolled
  • 46,435 Review available
  • 30 Hours on-demand videos
  • 140 Articles
  • Access on Mobile and TV
  • Assignments
  • Certificate of Completion
  • Lifetime Access
  • 30 days Money back guarantee
  • You can get the course at Discounted Price here.

Most attractive feature is 30 days Money Back Guarantee means there is NO RISK. If you didn’t like this Full Stack Web Development Online Course, you can refund your money back within 30 days of purchase.

Take-This-Course

Introduction to Full Stack Web Developer Online Course

This Course, as the name suggests Complete Web Developer Course, contains all the technology lectures in depth which are needed for web development. This course is about development of a complete web application that includes front end development, backend development and database as well. If one wants to learn web development then no better place than taking this course since it will take you through end to end web development.Complete Web Developer Course

Best thing about this course is that although it seems a lot of things covered in this and this might seem lengthy but believe me these are bare minimal things that one must learn if wanted to start web development. This course starts with the frontend backbone HTML5 and covers till the database part as well. Couple of cool things to learn in this course apart of most essential and mandatory parts is BootStrap, Python.

I have never seen any web development course that provides lectures on these parts. Most of the time the web development courses are limited to HTML, CSS and PHP and may be somewhere you can find javascript or jquery as well. Python is really cool language to learn for and it is not touched upon, this course has good explanation about Python, the same goes for BootStrap as well.

When developing some web applications there are requirements like to show the map on the webpage, let say for address only, a very basic one, or show the weather on page. You will find how to integrate these all in the API section of the course.

Who is this Online Course for?

  • Well anyone who is interested in learning web development can take this course.
  • One who is already in web development also can take this course since there are really good things covered in this course that are Bootstrap, Python, API’s.
  • Prior knowledge always helps one have, but this course has the latest technologies involved which make us up to date with market.
  • If you want to learn end to end web development then go ahead and take this course.

How you use yourself?

  • When we take any course and if is a software development or a web development or application development, the foremost thing is to understand the in-depth concept of the language or platform on which the course is. Which this course provides before starting the real coding stuff.
  • Secondly, see the course is designed in such a fantastic way that at the end you will end up in learning the complete web development that will include front-end as well the back end as well.
  • When you are taking this course I would suggest you to keep practicing the concepts that you are learning and start writing code around it, either it is HTML try creating a simple HTML Form, apply CSS to beaufity it, have PHP plugged in it. Create database schema and try to create an end to end small web application. Try one with PHP + BootStrap as well.
  • Although the course has very good examples of code with each and every topic but keep writing more and more code around the concept on which you are currently learning. So whenever learning a topic with the tutorial keep writing code around it and target a simple complete web application that you are going to develop after learning this course and write code around it with each relative topic of the course.Take-This-Course

Online Course Topic Details:

So let’s start talking about the course content one by one.

  • This course starts from HTML5, needless to say the most essential language to develop front end, this course covers HTML5, which is the latest version of HTML.
  • Once you will be done by learning HTML5, and start developing HTML pages, there you will think about beautification of webpage and placing the contents of webpage on right places and so on. Here CSS will come into picture, which is next step to learn with this tutorial series. Good thing about this tutorial is that this tutorial contains CSS3 in the course content which is again the latest version which is great to learn for and start with the latest version.
  • JQuery and JavaScript are comes into play when you deal with html forms and so, this course has very detailed lectures about these two technologies as well.
  • Moving forward to BootStrap4, which is most famous framework for building responsive web applications, again the beauty of this series is that, it includes BootStrap4 which is again the latest and always a positive impact on learning and profile as well, when one starts with the latest version of a framework.
  • WordPress that is open source CMS (content management system) which is developed in PHP as a base language is a very efficient for blog creation and web application development.
  • Next thing to learn with this tutorial is PHP, which is very powerful scripting language for developing from a very simple to very complex web application. PHP is very popular in web application development world, since it is not very difficult to learn, but you can on board yourself as a PHP developer very soon.
  • Once you will be done from PHP, next thing to learn is mysql database server, where you will learn how to create DB’s, tables and how to connect your application to mysql, performing CRUD operations and all.
  • Till here if you keep developing and practicing every concept, you will be able to create a simple web application by your own. That can have HTML,CSS, PHP, MYSQL or it can be using BootStrap, PHP, MYSQL. Again I would like to add is keep practicing the concepts, write more and more code.
  • Next thing to learn after this is API’s, you may need to add the google map in your web application, google provides API’s for that but how to use these API’s and how to embed these API’s with your application that you will learn in this section. Pretty useful section and useful topic to learn for.
  • Now what all we will talk next are a bonus, a real bonus. Python, which is an object oriented programming language with dynamic semantics. It’s really fantastic to write code in python if you know the syntax and semantics. This course covers just not only basic concepts of python but also at some extent good deep down on the concepts that we need to know. Overall this course is a complete package for one who really want to learn web development.

Taking this Online Course:

Once you complete this course you will find yourself as a developer who will be able to create an end to end complete web application. You will be able to know and easily write the HTML codes, CSS stylesheets, PHP code and you will be easily develop some really cool web application using these languages. See logic is something that no one can teach you but if you can place the right programming logic at the right place after learning the concepts then you will be very easily create web application by your own one after another.

How to best utilize this Online Course:

  • To best utilize this course as I talked in previous sections is to start writing code in parallel.
  • Have an complete web application with will be simple not necessarily complex in mind and start development around it, like a simple web application like library management, where you will have to add, update, delete book records.
  • Have a structure of the web pages which this application will have, in mind and when you are learning the concept, try to utilize the concept and start writing code.
  • Writing much and more code that will make you comfortable with HTML, CSS, PHP and you will also know what you are writing and what will happen when you will run this piece of code.
  • Each and every concept explained in this course has its own importance and one not miss any of the concepts and try to grasp as much as you can.
  • The video tutorial series has more than enough that you need to know about web development but practicing is one thing that makes you aware of the concepts very well and the much you will practice with the course the more you will find yourself comfortable in as a web developer.

Any downside/disadvantages of Online Course:

I don’t foresee any disadvantages with this Web Development Tutorial, and learning new things never have any disadvantages. Even I am really impressed the content and knowledge of author. Also there are no less but more things in this course to learn, like I kept talking Python, API’s and all.

I believe adding AngularJs would make this course more helpful but undoubtedly, it’s another huge area. You can follow for Angular 4 (formerly Angular 2) – A Complete Guide.

Summary/Closing Notes:

At the end I would say if one really want to get into web development then take this course. This course will take you through each and every concept in very much detail and in very refined manner of explanation. Learn each and every concept well and practice these concepts, keep writing code, that will give you the confidence, which you can encash creating really cool and complex web applications.Take-This-Course

Happy Learning…

Learn Angular 4 (formerly Angular 2) — The Complete Guide

Stay hungry, Stay Foolish ~ Steve Jobs

AngularJS is an open-source JavaScript Framework based on MV-* design for building new generation web applications. AngularJS has adapted the best approach to web advancement. AngularJS has lots of amazing features that make it different from other JavaScript Frameworks and libraries.

Learning Angularjs (especially the latest version of it i.e. angular 4) will definitely gives a boost to your career because the demand for angularjs in the market is increasing at a tremendous pace. Below you can find that how the demand of Angularjs developer increased at amazing speed as compared to other JavaScript technologies like ReactJs, BackboneJS and EmberJs and it’s increasing more as angular4 has come with much more maturity.Indeed Job Trends

But it’s not only the job market but salaries for Angularjs developer are also high as compared to other job postings overall. Below are the statistics from Indeed.com.Angularjs Salary Trends

So moving to angularjs or improving angularjs skills will give your career a tremendous boost.

We’ll strongly recommend to take an Online Course by Maximilian Schwarzmüller that covers the latest version of Angularjs (Angular4 and Angular2) and it covers almost each and every concept related to it. We have given a detailed review of this course below for our readers but just wanted to highlight some points:

  • Declared Best Seller at udemy.com
  • 67,450+ students enrolled
  • 20,714 Review available
  • 22 Hours on-demand videos
  • 17 Articles
  • 76 Supplemental Resource
  • Access on Mobile and TV
  • Assignments
  • Certificate of Completion
  • Lifetime Access
  • 30 days Money back guarantee

Most attractive feature is 30 days Money Back Guarantee means there is no risk. If you didn’t like this AngularJS online course, you can refund your money back within next 30 days.

Take-This-CourseAngularjs 4 Online Course Feedback

Introduction to AngularJs 4 Online Course

This course is about web development using Angular4. The most popular front end web development language across world. This course is about development of front-end using Angular4 the successor of Angular2 platform. This course demonstrates not only the development using Angular but also the internal architecture of the language which makes this course great.

  • Develop Modern, Complex, Responsive and Scalable Web Applications with Angular 4
  • Fully understand the architecture behind an Angular 4 application and how to use it?
  • Use their gained, deep understanding of the Angular 4 fundamentals to quickly establish themselves as front-end developers
  • Create single-page applications with one of the most modern JavaScript frameworks out there

Take This Online Course – Lifetime Access

Angular4 - formerly Angular2

Prior knowledge is one thing that always helps one when we talk about learning the new thing or taking a new course. And there is always a doubt that how it will help one afterwards upon completion of course. See in this course if you have prior experience of Angular or JavaScript is always an advantage and even if you don’t have any experience in these, mark my words this course helps in understanding the concepts and even from a ground zero. So there is no prior experience kind of thing upon taking this course, anyone can take this course if interested in angular learning and the future of web development.

When we talk about the website development, there is most common term now a day is responsiveness, that the website must be responsive. With Angular.js one can develop responsive web application frontend. Also when we talk about the responsive web application how can one forget about the scalability of a web application. Angular.js language also helps us in development of highly scalable and more responsive web application. These two are major considerations when one starts development of a new web application, and development using angular.js make is possible for one to develop more responsive and highly scalable web application with complex architecture.

The good thing about this course is that, explanation of these concepts is in very detailed and very understandable manner with example in such a way that even a lay man will understand what scalability and responsiveness of web application is.

Now days there are lot of talks about SPA – single page website development, and even there are many one pager web applications are there if you have noticed. This kind of one pager application is not only very fascinating but also very popular. This course has very detailed explanation of developing such kind of web applications.

You can find a list of Latest available Angularjs Jobs (Updated Regularly) at the end of this Online Course preview. You can easily see that this Angular Online Course cover almost all the requirements for the posted jobs.

Who is this course for?

Well if we talk about who can take this course, who should take this course and who must take this course. See learning is something which never wastes and some point of time what we had learnt is always useful for us.

  • If you are already in web development then you must take this course, since it will going to take you miles ahead in frontend development.
  • This course has angular internal architecture explained so you can easily understand that what you are writing will make what impact. Since most of the times a developer does not know what’s going on behind the scenes when writing this piece of line or this line of code, of course developer knows what will happen if I write a particular line of code or a particular piece of code but you are never aware of what going on behind the scenes.
  • This course helps in understand not only the coding fundamentals but also the internal processing at the architecture level what is going on behind the scenes.
  • One who does not have any idea about the frontend development and javascript, don’t worry this course is designed in such a way that you will learn even if you have no idea about the front end development.
  • If you are in web development then you must take this course.

Take-This-Course

How you use yourself?

  • When we take any course and if is a software development or a web development or application development, the foremost thing is to understand the in-depth concept of the language or platform on which the course is. Which this course provides before starting the real coding stuff.
  • Secondly, see the course is designed in such a fantastic way that at the end you will end up in learning the complete in and out of the language. When you are taking this course I would suggest you to keep practicing the concepts that you are learning and start writing code around it.
  • Although the course has very good examples of code with each and every topic but keep writing more and more code around the concept on which you are currently learning.
  • Whenever learning a topic with the tutorial keep writing code around it and target a simple application that you are going to develop after learning this course and write code around it with each relative topic of the course.

Course Topics details:

This course starts from Course Introduction and ends with development of our own application covering even the very small concept.

  • There is no even a very single important concept left in the course.
  • This course also explains why one should take this course and why angular is so important in web development. Most of the courses do not explain the initial environment setup to start development.
  • Good thing about this course is that the most basic things like this is also covered in this course.
  • Going forward with this course explains the Components and Databinding.
  • Debugging is most important thing when we write an application and if there is some issue with our code then either we scan the log files and find the errors and other thing is to debug it. From debugging one can easily find the bug and fix is in very efficient and lesser time.
  • Directives are something that are extended with HTML and angular has its own directives with ng prefix are covered and explained in detail in this course.
  • Apart of this there is most important principle of software development that is being using extensively in lot of software development platforms that is dependency injection, this course have very detailed and dedicated lecture about DI (Dependency Injection) with angular.
  • Routing is covered with this course that is to route one angular page to other with detailed lectures and dedicated lesson for in-depth concepts.
  • When we write any HTTP or web application then most important thing is that we should be very aware about the HTTP like sending data and getting data using HTTP Post and Get. This course covers HTTP concepts with example using observables and Pipes in angular.
  • Also there is a lot of very very important to learn concepts like authentication, Type scripts with this course that one must learn.
  • Type scripts is itself a very complex and important to learn concept which is not covered in most of the Angular tutorials, is not just covered but also explained with examples and in a way that one can grasp and implement easily with this course.

What happen as a result of taking this course?

Once you complete this course you will find yourself as a developer who knows angular very well, in detail and with architecture as well. If one keep practicing the concepts that are explained in the course then mark my words you will be able to develop an application with angular.js, keeping design principles in mind and more efficient, scalable and responsive as well. You will be able to setup the environment, start writing the web application that has the front end with angular and also the complex application using most of the concepts of angular. If you don’t know anything about the JavaScript even then you will find yourself as a angular developer at the end of this course series.

You will be able to grasp the AngularJs in more practical and professional way that will help you in getting AngularJs Jobs very easily.

How to best utilize this course?

  • To best utilize this course as I talked in previous sections is to start writing code in parallel.
  • Have an application with will be simple not necessarily complex in mind and start development around it, like a simple web application where user can login and register, have a structure of your web pages in mind and when you are learning the concept, try to utilize the concept and start writing code, write much and more code that will make you comfortable in angular and you will also know what you are writing and what will happen when it will compile and how much memory efficient your code is.
  • Each and every concept explained in this course has its own importance and one not miss any of the concepts and try to grasp as much as you can.
  • The video tutorial series has ample that you need to know about angular but practicing is one thing that makes you aware of the concepts very well and the much you will practice with the course the more you will find yourself comfortable in Angular.

Summary/Closing Notes:

If you really want to learn angular4, there is nothing better place than taking this course. No matter if you are a green horn in web development or you finds yourself a champ of java script and want to learn angular, go with this course and see at the end what you learn. Learning is something that should never stops to keep our self, up to date with the new technologies in this competitive world.Take-This-Course

Happy Learning…


Recents AngularJS Jobs

Remote Front End Developer
Source: Indeed
Details: AngularJS 1.x, LESS/SASS, Gulp, ES6 syntax - RESTful services and application architecture - Automated testing with Karma, Jasmine, or similar frameworks....  More
16 hours ago

Washington, DC 22-June-2017

Remote AngularJS Developer/ Mean Stack
Source: Indeed
Details: Those three skills along with AngularJS 3 as well would be great. Strong experience designing, developing, testing and implementing a variety of API’s,...  More
6 days ago

San Francisco, CA 16-June-2017

AngularJS Developer
Source: Indeed
Details: Description You a top-notch front-end developer. You eat, sleep, and dream in Angular. You want to join our team! We are an agile shop, with daily checkins  More
20 hours ago

Ann Arbor, MI 22-June-2017

AngularJS Developer
Source: Indeed
Details: Job Description: · Strong JAVA Backend developer.· Strong in Spring Framework· UI is important – Angular JS· Strong in SQL. Any DB is fine. DB2 will be  More
7 days ago

Atlanta, GA 15-June-2017

C# .Net Developer (Locals Only)
Source: Indeed
Details: 1.Good in C# and Microsoft .Net 2.Powershell 3.AngularJS, ASP.NET MVC, JQuery, HTML5 4.Sql Server Good to have experience on below: 1.Exchange build  More
15 hours ago

Redmond, WA 22-June-2017

Full Stack C# / ASP.NET Developer - Work Remote (Skype)
Source: Indeed
Details: AngularJS, Knockout, React, Ember... Full Stack C# / ASP.NET Developer - Azure Web Apps / Cloud Services, AngularJS, HTML5, CSS3 – Work Remote*. Love to learn?...  More
22 days ago

Knoxville, TN 37934 31-May-2017

Full Stack C# / ASP.NET Developer - Work Remote (Skype)
Source: Indeed
Details: AngularJS, Knockout, React, Ember... Full Stack C# / ASP.NET Developer - Azure Web Apps / Cloud Services, AngularJS, HTML5, CSS3 – Work Remote*. Love to learn?...  More
22 days ago

Atlanta North, GA 31-May-2017

Front End Developer - Remote
Source: Indeed
Details: AngularJS 1.x, LESS/SASS, Gulp, ES6 syntax - RESTful services and application architecture. LOCAL CANDIDATES ONLY!...  More
23 days ago

Washington, DC 30-May-2017

UI Developer- Angular 2
Source: Theoris
Details: Job Title: Angular 2 developer Location: Indianapolis, IN Length of Engagement: 5+ month contract Years of Experience: 4+ years of experience w...  More
18 hours ago

Indianapolis, IN 22-June-2017

.Net Developer with Angular JS
Source: Indeed
Details: *Role : .Net Developer ( With Angular JS 2)* *Location: Philadelphia, PA* *Duration: 1+ year* *F2F INTERVIEW IS A MUST.. NO EXCEPTIONS* *W2 ONLY. NO C2C*   More
1 day ago

Philadelphia, PA 21-June-2017

Ionic/Angular Developer
Source: Shipt
Details: Shipt is improving lives by giving people back more of their time, the most valuable resource. Be a part of building an amazing grocery delivery experience.  More
3 days ago

San Francisco, CA 20-June-2017

Ionic/Angular Developer
Source: Shipt
Details: Shipt is improving lives by giving people back more of their time, the most valuable resource. Be a part of building an amazing grocery delivery experience.  More
3 days ago

Birmingham, AL 35203 20-June-2017

AngularJS Developer
Source: conrep
Details: 1.Angular JS 2. Java, Spring 2.Pivotal Cloud Foundry (PCF) 3.Spring boot 4.Restful Service 5.Junit 6  More
30+ days ago

Seattle, WA 98101 06-May-2017

Angular.JS Developer
Source: conrep
Details: ⿢ Deep knowledge of AngularJS 2.0 practices and commonly used modules based on extensive work experience. ⿢ Creating custom, general use modules and components...  More
8 days ago

Philadelphia, PA 19092 14-June-2017

Angular 2 Developer
Source: Indeed
Details: *For all applicants: * *Minimum relevant experience: 8 years* *Please send your resume in Microsoft Word format.* *Resume MUST be within 4 page limits.*   More
6 days ago

New York, NY 16-June-2017

Yii2 Developer Needed for Immediate Short Term Contract
Source: Indeed
Details: We are looking for an experienced Yii2 Developer for a Short Term 2-3 Week contract with an opportunity for a continued work duration. This is an immediate  More
16 hours ago

Irvine, CA 92606 22-June-2017

AngularJS Developer
Source: Indeed
Details: We are innovators in software defined storage. Storage infrastructure should be agile and evolve as rapidly as needs do. At the same time deploying and  More
30+ days ago

Seattle, WA 01-May-2017

Sr. .Net Application Developer with AngularJS
Source: Indeed
Details: Design, development and implementation of mission critical applications using the AngularJS 2.0, .NET Framework and SQL technology stack....  More
5 days ago

San Francisco Bay Area, CA 17-June-2017

UI/ UX developer
Source: Indeed
Details: 5+ years of experience developing modular front-end components and building advanced web experiences using HTML5, CSS3, JavaScript, AngularJs 1.x & Preferably 2...  More
6 days ago

Miami, FL 16-June-2017

AngularJS Developer
Source: Indeed
Details: Must have 2 years of demonstrated experience with AngularJS. Synthesis Systems is seeking an AngularJS Developer for a long-term, contract opportunity in...  More
30+ days ago

Alexandria, VA 18-May-2017

Dot Net Developer
Source: Indeed
Details: *SHOULD BE WILLING TO WORK ON OUR W2* You will be working with the team IT manager to build and deploy a web-based hardware asset management storefront. They  More
16 hours ago

Chattanooga, TN 22-June-2017

AngularJS Developer
Source: Accenture
Details: Join Accenture and help transform leading organizations and communities around the world. The sheer scale of our capabilities and client engagements and the  More
30+ days ago

Florham Park, NJ 09-May-2017

Software Developer (Contractor)
Source: Indeed
Details: Familiarity with JavaScript frameworks like jQuery, angularjs, underscorejs, BootstrapJS - or similar frameworks VueJS, BackboneJS....  More
8 days ago

Akron, OH 14-June-2017

Frontend Developer - JavaScript/Angular
Source: TapClicks
Details: TapClicks [www.tapclicks.com] - San Jose, California Hi! We're one of the fastest growing companies in Silicon Valley and America. Inc. magazine ranked...  More
19 days ago

San Jose, CA 04-June-2017

Mid-Level Full-Stack .Net Developer
Source: Indeed
Details: Experience with AngularJS/ Bootstrap .Net Frameworks and Adobe Experience Manager - AEM is highly preferred. Must have a minimum of 8+ years of solid Full-Stack...  More
1 day ago

Hagerstown, MD 21-June-2017

MUST Have Core Java Interview Questions

Another article in series of Technical Interview Questions and Answers on Web Development Tutorial covering Core Java Interview Questions this time. You will find more detailed answers to mostly asked interview questions during a technical interview. Java Interview Questions and Answers

Java Interview Questions PDF version will be available later for download.


Following Related Technical Interview Questions and Answers will also be helpful.


Complete Java Interview Questions List

Courses Online

What is object oriented programming. How java differs from other object orienting programming languages like C++?

Object oriented programming, primarily known as OOP, is a programming paradigm, which simplifies the development of software using some key concept provided to make development easier and faster.  An object is something that has state and behavior. An object can have data, fields, methods. Objects can talk, access to other objects. Access would be granted based on the modifiers. A class in OOP stores information and demonstrate the information using methods, so class is basically blueprint of an object.

Let’s talk in brief about different components of Object Oriented Programming:

  • Object
  • Class
  • Encapsulation
  • Abstraction
  • Polymorphism
  • Inheritance

Object:

Object is something that has state and behavior. We can easily relate object to some real world objects like machine, car etc.

Class:

Class is basically a logical collection of objects. That can have multiple methods, variables encapsulated in it.

Encapsulation:

As the name suggests, encapsulation is basically to encapsulate multiple logically related things together in an entity that is called class and provide proper access modifiers to the variables, so that these can not be accessed directly from outer world.

Abstraction :

Consider a scenario, where you are writing some logic that you don’t want to expose to outer world, so we just expose declaration of the thing to outer world with help of interfaces so that the implementation will be completely hidden from outer world, Like we have a code that checks if   an number is palindrome or not, so we need not show our logic to calling code. We will just create an interface which will have a method and takes a parameter of which will a number and return a boolean based on our computation.  This is called abstraction, where the calling code does not know anything about the implementation.

Polymorphism :

If we go by definition, polymorphism means one name many forms. The same we apply while writing code in a language that is object oriented. So practically we create methods that have the same name but differs in parameters, it is called polymorphism. Where a single method name have more than one implementation. In java we use concepts like method overloading and method overriding to achieve the same.

Inheritance:

Whenever we write code, we always think of re-usability or extension of the code that is already written. So in inheritance an object takes all or some properties of the class that is parent to this.

We will talk in detail about these concepts. This is very basic overview about Object oriented programming and object oriented programming concepts.

Now lets talk about Java, so Java is an object oriented programming language that is extensively used in software world to create highly secure, robust software.

The main and most important feature of java that make it differ from other OOP programming languages is that Java is platform independent. When we say platform independent then it means write once and run anywhere. Java compiler creates a byte code that can be executed across JVM’s that can be Linux, that can be Windows, that can be MAC and so on.

If we talk about some key differences between C++ and Java then, although both languages are object oriented programming languages but still there are some key differences between these two :

  • C++ is platform dependent language, whereas Java is platform independent language.
  • C++ support multiple inheritance, whereas java removes multiple inheritance, since it can cause DOD that is Diamond of Death problem.
  • Pointers, C++ has support for pointers, Java also has support but java internally uses pointers. Programmer doesn’t have to write pointer code explicitly.
  • C++ does not have multithreading support, whereas Java provides support for multi-threading.

And so and so on, there are many differences between these two languages but these are the key ones.

Back to top

Explain installation and environment setup of java. Briefly explain what is JRE,JDK and JVM?

First we need to download the executable file from http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html as per our operating system. One done with download the executable file , run the file and it will install java to our system and on successful installation the folder structure will look like this:Java Installation

So we have downloaded and installed the Java Development Kit and we are ready to go to code. Before processing forward we need to set the environment variable so that when we run java from command prompt operating system will aware what kind of program to run.

To achieve this, we need to traverse through the path below:Java Path

Now click on Advance system settings link that is on the left pen of this page, this will open a window like this:Java Environment Variables

Now clink on the highlighted one, that is Environment variables. Upon clicking this a new window will open, under this , click on new under System Variables and create a new System Variable and name it to JAVA_HOME, against variable value we need to path of java installation directory that is with my system is:

C:\Program Files\Java\jdk1.7.0_79.

Lets set this and see how it looks:Java Home Setting

Click on OK button and we are done with creating a new system variable JAVA_HOME. Next step is to add this variable to path. Under the same system variables there will a variable path, edit it and add JAVA_HOME to path.

That’s it we are good to go to write our first java code. Lets check with command prompt if the installation and configuration went fine or not:Java Installation and Configuration

So I have checked java version with command prompt, if there is anything wrong with configuration or installation this command will not get successfully executed and there will be error message. So this is a small way to check installation of java.

JRE is basically shorthand for Java Runtime Environment. It is basically the Java Virtual Machine where your Java programs run on. It also includes browser plugins for Applet execution.

JDK is shorthand used for Java Development Kit, which is the Software Development Kit for Java, including JRE, and the compilers and tools (like JavaDoc, and Java Debugger) to create and compile programs.

Usually, when you only care about running Java programs on your browser or computer you will only install JRE. It’s all you need. On the other hand, if you are planning to do some Java programming, you will also need JDK.

JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed.

Back to top

What is polymorphism, Explain inheritance in java? Also explain overloading and overriding in java.

Polymorphism in object oriented programming is a concept where in an object can take one or more forms. Its like one name many forms. Any java object is elibigle to called polymorphic when an object “IS-A” kind of object. For example we have a parent class, then the eligible child classes can be Audi, BMW etc. So these child classes will extend the parent class that is Car and at the same time we can say Audi “IS-A” car, which makes Audi or BMW object polymorphic.

Lets understand the same with an example.

Here we will be creating a Car interface and this interface will have some methods that will be common to call cars.

So we have created a simple interface that is called Icar. This interface has two dummy methods that will setEngineCapacity and getEngineCapacity.

Now lets create impl classes for this.

First let say we create AudiImpl class that will for car audi.

Now lets create BMWImpl class with our ICar interface implementation.

Lets create a Main class and try to understand the IS-A concept that is behind Polymorphism.

So first thing to notice is that when the objects are polymorphic in nature we can create the objects with Interface reference. Now both AudiImpl and BMWImpl implements the ICar interface, so we can say that these two objects “IS-A” ICar type.

Next thing comes DynamicBinding,  which is the calling code even doesnot know on what type object the call is made. See getCarEngine method, here we are just passing objects from our main method but we are receiving the object in ICar interface and we made call to our actual object. This is beauty of polymorphism.

Now lets talk in brief about overloading and overriding.

We call Overloading, when two or more methods in one class have the same method name but different parameters.

We call Overriding, when two methods with the same method name and parameters. But Import point to note is one of the methods will be present in the parent class and the other is in the child class. Overriding allows a child class to provide a specific implementation of a method that is already provided its parent class.

Back to top

What are different types of class loaders in java, explain class loading in java?

There are three kinds of class loaders in java :

  • Bootstrap (primordial)
  • Extensions
  • System

BootStrap or Primordial class loaders are class loaders that Loads JDK internal classes, java.* packages. Which will be defined in the sun.boot.class.path system property, typically loads rt.jar and i18n.jar.

Extensions class loaders are class loaders that Loads jar files from JDK extensions directory. Which will be defined in the java.ext.dirs system property – usually lib/ext directory of the JRE.

 

System class loaders are class loaders that Loads classes from system classpath Which will be defined in the java.class.path property, which is set by the CLASSPATH environment variable or –classpath  command line options.System Class Loader

Class loaders are hierarchical, and maintain visibility. Bootstrap class loader have no visibility on the class loaded by Extension class loader and Extension class loader have no visibility over the classes loaded by classpath loader or System class loader.

Class loaders use a delegation model when loading a class. They request their parent to load the class first before they attempt to load it by their own. When a class loader loads a class, the child class loaders in the hierarchy will never load the class again, here classloaders maintain uniqueness.

Classes loaded by a child class loader have visibility over the classes loaded by its parents but not vice versa.

Back to top

What is difference between Composition and Aggregation?

Composition and Aggregation are concepts where two objects use each other’s functionality. When one object use functionality or services exposed by other object it is called Association.

Composition is when one object or one class associated with other class or object in such a way that the class can not have any meaning if other class is not present. Lets take an example of Bike, a Bike  have many objects like Tyres, Engine, Gear and so on, but when the bike is destroyed all these objects will also destroyed. These objects can not function if there is no car object. This concept is called Composition in java.

Aggregation is when two or more objects are associated with each other in such a way that if any of the object dies or destroyed, other one will still exist. Lets take an example, A Company can have many employees, when a scenario where Company is closed, Employee can join other company as well.

We can say composition is stronger than Aggregation.  A relationship between two objects is known as  an association, and an association when one object owns other is known as composition, while when an association one object uses another object is known as aggregation.Composition Vs Aggregation

So as we can see, Composition represents the strongest form of relation between objects where as Aggregation denotes a slightly weaker relationship between objects then composition, Association is most general form of relationship.

Lets take a practical example of Composition. Here we will create a Class name Bike, and other class as Tyre, that will have brand variable in it. Lets create this:

So as you can see Bike class constructor is initializing Tyre class, so the lifetime of class Tyre associated with Bike object, and whenever Bike class will destroyed the Tyre class will also destroyed. These both objects have strong relationship with each other and this is what we call Composition.

Lets take example of aggregation, here we will have a class Company and the company will have list of Departments. Now the difference with this is, Company class is not responsible for initializing the department class, and when the Company class will be destroyed the same Department class will not get destroyed, since both have their own life cycle. This is what we call Aggregation.

Back to top

Continue with More Java Interview Questions and Answers:

What is difference between Abstract class and Interface in Java, also explain when to use what?

In OOPS there is a principle called Abstraction, that is to abstract things from outer world. To achieve this interface and abstract classes are used.  Abstract classes are the classes in java that can have methods in such a way that some can have implementation and some will not have. These unimplemented methods are called abstract methods and we use abstract keyword to declare such methods. Now thing is we can not instantiate the abstract class. One more thing with abstract class is that there must be one method that will be abstract in this class to be called as abstract, if there is no abstract then we can not write class as abstract, the compiler will complain. Same if there is any abstract method in there and we declare the class as normal class then also compiler will complain and force us to declare class as abstract. These classes are meant to written for inheritance.

On the other hand interfaces are also abstract classes but these are pure abstract classes. Like we talked about the declaration and definition of methods in abstract  class like some can have some  may not have implementation, but in interfaces methods that we write are 100% abstract, mean there will only be declaration and the class that is implementing the interface, that class will have to provide the implementation. Methods declared in interfaces are by default abstract. We write these both to achieve abstraction. Like let say I have a service, whose job is to insert some data in database after some processing, so I will only provide the service interface to outer world with some methods. The actual processing will be done in the implementing class of this interface and the implementation I will hide from outer world. This is beauty of abstraction.

Lets take example of how we write abstract class and interface.

Lets create an interface named IVehicle that will have some methods in it:

So what we have done is we have created an interface named IVehicle with some methods in it, so every class that will implement this will have to provide implementation of these methods.

Now there are some methods, in which Brand, Model, EngineCapacity and FuelType will be provided. So now we will create one more level of abstraction and we will segregate the classes with one that have fuel type as diesel and one with fuel type as petrol. Why we will do this because all petrol cars object will not have to implement these methods. So we will create two abstract classes, lets create them:

So now we have created a hierarchy and added one level of abstraction. Every petrol type vehicle will have to extend the AbstractPetrolVehicle and every diesel type of vehicle will have to extend the AbstractDieselVehicle abstract class and the class have to provide the implementation for rest of the methods. Below is the example for AudiA3 class that extends AbstractPetrolVehicle and this class has to provide the methods implementation.

Back to top

Explain serialization in java, what is use of Serial Version UID?

Serialization is the process wherein object is converted into bytestream and it’s state is saved, so that the object can be travel over the network. In order to achieve serialization java provides Serializable interface, that is marker interface. So any object on which we need to achieve serialization, the class must extend Serializable interface.

The process from which the byte stream converted to java object again is known as deserialization. In this the persisted file or the serialized byte stream is converted in java object.

As we talked about the Serializable interface, the above pasted code is the code for this interface, as you can see there are no methods in this interface that’s why these type of interfaces are known as marker interface. They just let the jvm know that what type of object it is, rest JVM takes care of.

There can be a scenario wherein we don’t want to serialize all the fields of a class, and we want some fields should not get serialized, to achieve java provides one more keyword that is transient. All fields maked as transient will not be part of the serialization process.

Since serialization is the process where object’s state is persisted, so obviously the question comes in our mind, what about the static things. Since static variables are directly belong to a class and they don’t have anything to do with object. So the answer is that the static variables are not part of serialization  process as well, since first thing they belong to a class and not with an object and second is they are not part of object state.

SerialVersionUId , whenever we are going to serialize and our class implement serializable interface the IDE says something like this,

The serializable class doesn’t declare a static final serialVersionId of type Long.

So why it is always encouraged to use SerialVersionUID, basically this id is something unique that represents the object and whenever the object is being deserialized this id is being matched and if the id doesnot matches jvm throws InvalidClassException. This id is being placed just to ensure that the object is the same that it was at the time of serialization.

If one doesnot provide the serialVersionUId then the JVM automatically calculate the serialVersionUid and provide one. The same is calculated as the hashcode of the class and the membervariables and so.

One more question arises to our mind is that just above we talked about that the static variables are not part of serialization process since they doesnot belongs to the object state. And now we are talking about that the serialversionUid is used at the time of deserialization, meaning that the serialVersionUID is part of object byte array that is crated at the time of serialization. Its contradictory isn’t it ? Yes !! So what happens is that whenever the object is converted into the sequence of bytes at the time of serialization, then the serialVersionUid is added to the class metadata. And the same is travelled to the network so that whenever the deserialization process happenes the jvm quickly pickup the serialVesrionUID and matches it.

Lets take an example of the same:

First we will create a class name Car which is going to be serialize.

Lets serialize and deserialize, and check if we got the same object or not.

Lets run the code and see if got the same object that we serialize, with make as 2016 and model as Audi-A3.

Upon running the code what we got id:Serialization in Java

So we got the same object that we serialized. This was the code running example of serialization concept.
Back to top

Explain cloning concept, what is difference between shallow and deep cloning in java? Explain with example.

Cloning is a concept where in as the name suggests copy of an existing object is made. There are two types of cloning concepts in java, one is shallow cloning and other one is deep cloning. Both are used to make copy of an object, but there is subtle difference between these two, that we will talk in detail.

To clone some object in java, java provides clone() method, which does the duplication or cloning task. To use the clone method the class must implement Cloneable interface. If class or object whose clone needs to be created, doesnot implement Cloneable interface, jvm throws error. The clone() method is defined in Object class.

By default clone() methods gives shallow copy of the object. If one wants to have deep copy the clone method must be updated.

Shallow and Deep Copy:

Lets understand the concept with help of a diagram:Shallow Vs Deep Copy

Actual Object that have the Object2 in it. Upon performing shallow copy , in memory the objects will look like:Making Shallow Copy in Java

Lets check the memory footprint when deep copy is performed:Making Deep Copy in Java

As demonstrated in diagram, Shallow copy is something where the contents of an object are not duplicated, but the newly created object will also have reference to the existing object. That means if I update some in object1 the same will be reflected in cloned object as well. By default the Object class’s clone methods gives the shallow copy of an object.

Deep copy is the concept where the object is actually duplicated. When deep copy is made there will be two different object created. So in essence when we create deep copy there will be two different object and once we do some modification on object1 the same will never be reflect on object2.

Lets take an example which demonstrates cloning:

Back to top

What are immutable in java, how to create immutable class/fields/methods in java? Explain with example.

Immutable is something that is once created it can not be changed or modified. Immutability is a very important concept in terms of object state. Variables declared as immutable can be treated as constant, since they will never going to change. In java Strings are immutable, mean once declared a string it will never change, if we try to manipulate the string like add some to the same that will result in a new object but the main object will remain intact.

When we are going to create something immutable, final keyword is used. The same can be used with class, fields and methods of a class. There are something to take care or keep in mind when writing final, if a class declared as final the class cannot be extended. If variable is declared with final then the variable will not be reassigned.

When we write final class one thing that is very important and to keep in mind as well is that,

  • Remember the immutable objects cannot be modified so there will be no setters in the class that is going to be final.
  • Class should be declared as final so that no class can extend this.
  • Setting of variable values will be via constructor only.
  • If there is any thing in the immutable class that is mutable, then always always return the copy of it and never the original object.

Lets now create an immutable object, with three fields in it. So the fields will be id, name and a List. Lets create immutable class with these fields:

So our immutable class is ready and good to go. If you check the code properly so the values been set are set via constructor only, since there is no setter for any fields, which should and must not be present. Class is declared as final so that no class can extends this. If one try to extend class then the compiler will throw error. Check the code below compiler throws error in this case.

We have a mutable field List in our code, if we directly return the original object then the caller can change the object, so we are creating a new list and returning the same to calling code.

Back to top

What is equals and hashcode contract. Explain with example.

Both equals and hashcode methods comes with Object class. This class provides these two methods by default overridden with every class we create. Equals as the name suggests checks the equality of two objects, where as hashcode is unique for an object.

Lets see what oracle says about conract between equals and hashcode:

From https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html

And about equals method:

We must override equals and hashcode in our class when writing java code. Since the object’s equals method has the following code:

So as you can see this method only checks for references of the object and not the actual object. Lets take a practical example. We are going to create a class that will have some fields and we will not override equals methods and we will check what happens when we call equals method to check equality of both.

Allright so we have created two objects of Home with same parameters and in main methods we are going to check if these both objects are equal or not. Lets run the above program and see if these are equal or not.

Upon running the code above what we got is:Test Equal HashcodeStrange !! isn’t it ? We have created both objects with exact same parameters then how come these two objects are not equal. Remember in the above section we talked about the equals method of object class that the methods only checks the references and not the value, and in memory we have created two different objects, that’s the reason we got output as false upon comparing two objects.

How to solve this now ? Well we need to override equals method and write our equals logic.

Lets write the code for equals now:

So now we have equals method in place in our Home class, lets run the code again and see if it made any difference?Hashcode Test

Now our code is returning the correct output as true. And why it is? Because we have overridden the equals method from super class and added our code for object equality.

That’s the reason it is always advisable to override equals and hashcode methods while writing any class in java.

Back to top
This Java Tutorial Series is continued and you can find more Java Interview Questions in next Web Development Tutorial here.

Top Technical Interview Questions and Answers Series:

MUST Have C# Interview Questions and Answers – Part 2

This C# Tutorial Part-2 in series of C# Interview Questions with practical and detailed answers. In previous part, we covered many basic to intermediate level interview questions on C# with the help of practical examples. I’ll recommend strongly to go through part-1 in this series. We will continue this series to provide more practical details with real time scenarios and complete source code to grasp C# language concepts. But this time, we are understanding in a different way by comparing different concepts.C# Interview Questions and Answers

C# Interview Questions PDF version will be available later for download.


Following Technical Interview Questions and Answers will also be helpful.


Start Date: Aril 01, 2017 12:00 AM PST
End Date: May 01, 2017  6:00 AM PST

Udemy Courses Online

Take All Online Courses – Lifetime Access

Complete C# Interview Questions List

Managed Vs Unmanaged Code

Managed Code:

The code (like Vb.Net,C#,J#) which is written in .Net Framework and developed by .Net Framework and under the control of CLR(Common Language Runtime). And the garbage collector run automatically in managed code.

Unmanaged Code:

The code which is developed outside of the .Net framework is called unmanaged code. Unmanaged code does not run under the control of CLR. Unmanaged code executed with help of wrapper class CCW (COM Callable Wrapper) and RCW(Runtime Callable Wrapper). C++ can be used to write such application.

Back to top

Struct Vs class

Structs and classes are the template or blue print that is used to create an object of a class.

Class Struct
Classes can be inherited Structs are not inherited
Classes are reference type Structs are value type
It could be null It could not be null
Class can be abstract It cannot be abstract
You can override the method within class You cannot override the method within Struct
  • A struct always contain public default parameter less constructor it can not contain the private parameter less constructor.
  • Static constructor is triggered in case of class but not in case of structure.
    Output: This is Constructor B()

Back to top

Abstract Vs Interface

Abstract class and interface both are used to achieve abstraction (for hiding the functionality). Both contain the abstract method.

Abstract Class Interface
Abstract class contain both abstract and non-abstract method Interface contain only abstract method
It contain final, non-final,static,non-static variable It contain only static and final variable
Abstract class provides the implementation of interface It cannot provide implementation of abstract class
It does not support multiple inheritance Interface supports multiple inheritance
Abstract keyword is used to declare abstract class Interface keyword is used to declare the interface

Example of an Abstract class:

Example of Interface:

Back to top

Boxing Vs Unboxing

In C# there is three types of data type Value type,Reference Type and pointer type. The process of the converting a value type into reference type is called Boxing. While the Reference type is converting into value type called unboxing.

Example of Boxing and Unboxing:

Back to top

Method Overloading Vs Method Overriding

Method Overloading Method Overriding
Method Overloading is used for increasing the code readability Method Overriding is used for code re-usability
Parameter must be different Parameter must be same
It can perform within the class It occurs in two classes using inheritance (parent and child class)
It perform compile time polymorphism It perform runtime polymorphism
No special keyword to use for method overloading. It can perform simply within the class. Using virtual keyword with the base class method and override keyword with derived class method can achieved method overriding.

Example of Method Overloading:

Example of Method Overriding:

Back to top

Break and Continue Statements

Break statement is used to break out of loop that’s mean you can jump out of loop at the current position and it terminate the loop.

Continue statement is used to (one iteration) jump over one iteration and again it continues the loop.

Back to top

Constant Vs Read-Only

Constant and Read-only is the keyword that is used to make the field constant that can not be modified.

Constant Value:

Constant variable or local variable are assigned at the time of declaration they cannot be modified after the declaration. Constant variables are static by default hence you cannot use static keyword with the constant field (or variable).

ReadOnly:

A read-only field can be assigned either at the time of declaration or inside the constructor of the same class, that’s why read only field can be used run-time constant.

Back to top

Ref and out parameters

Ref and out parameters are used to pass an argument into a method. By using this parameter you can return more than one value.

In the case of ref parameter first you need to initialize it then pass to the method but for out parameter, you don’t need to initialize.

Ref:

The ref keyword is used to pass an argument as a reference. When the value of that parameter will be changed in the method, it will be reflected in the calling method.

It needs to be initialized before passing into the method.

Out:

The out keyword is used to pass an argument same as ref keyword but in the case of out ref, you can pass the argument without assigning the value. Instead, it must be initialized in the called method before it returns back to the calling method.

Back to top

String Vs String Builder

String:

String is Reference type data type, you cannot insert, modify or delete any data when a string is created that means in simple word we can say that string is an immutable means once you created the object of string you cannot modify it when you try to modify it will create a new object in memory.

String Builder:

String Builder is an object of string to work with string we have to use a namespace(“Using System. Text) so unlike string, a string builder is an object and we can apply insert, modify and remove function in string builder without creating a new object, It will automatically update in memory does not create new space in memory. We can also say that string builder is mutable that’s mean changeable.

Back to top

Array.copyTo() Vs Array.Clone()

Array.copyTo () and Array. Clone() both areused to replicate the element of existing Single dimension array.

Array.copyTo:

Array.copyTo () method copy the array’s element into existing/destination array with the reference of targeted instance of existing/destination array. You can say that Array.copyTo allows to replicate the into specified index.

Array.Clone():

Array. Clone () replicate the existing element array in the new array object containing all element of exiting array without having any reference.

Back to top

Dispose and Finalise methods

Memory management is a big challenge when you are developing a web Application/software as we know that Garbage Collector plays the main role in .Net to manage unmanaged resource and Dispose and finalize method both are part of Garbage Collector.

Dispose and finalize method both are used to reclaim the memory used by the unmanaged resource.

Dispose method Finalize method
Unlike Finalize method it is not directly called by GC, User has to write code to implement it. Finalized method is automatically called by GC when any resource goes out of scope or at end of program.
It is a faster method and called by the user for instant object disposal. It is a slower method and automatically called by GC at end of,User can only override method when indeed.
Dispose method is the part IDisposable interface in GC Finalize method is the part of object class in GC
Back to top

Late binding Vs Early binding

If the methods have same name and different parameter declare in a single class or methods have same name and same parameter but declare in different classes then it is called Binding or Polymorphism.

Late Binding:

It is also called runtime polymorphism; the situation arrives when methods are virtual and have same name and same parameter in different classes (must be derived class). Then it is called method overriding or late binding.

Late Binding:

It is also called compile time polymorphism; the situation arrived when methods have same name but different parameter in same class.

It is also called method overloading.

Back to top

IEnumerable & IQueryable

IEnumerable and IQueryable are used for data manipulation in LINQ from the database and collection.

IEnumerable IQueryable
It exists in System. Collections Namespace It exists in System.Linq Namespace
It is the best for query data from in memory collections like List, Array etc. It is best for query data from out-memory (like remote database, Service) collection.
It execute select query on server side, load data in memory on client side and then filter data. It executes select query on server side as well as filtered there.
Suitable for LINQ or Object and LINQ to XML queries Suitable for LINQ to SQL queries
It does not supports the custom query It supports custom query using Create Query and Execute method
It supports lazy loading that’s why suitable for paging It does not support lazy loading that’s why not suitable for paging