Shallow Copy Deep Copy Java example Before knowing about Shallow Copy and Deep Copy you need to know about Clonable interface. Clonable interface - Java has a clonable interface for make clone of any object. Clonable Interface is a marker interface. Clonable Interface has no method. Class which implements Clonable interface, JVM give the permission for making the clone of this class. Shallow Copy - Clone can be archived by object.clone() method. It gives the Shallow copy of the object. In this process a new object is created That have all the value and instance variable. And if main object has any references to other object then the references are copied in the shallow copy. Example - class A implements Cloneable{ A(String personName, Integer age){ ...
Database Connection using NODE JS example In my earlier article, you have learned how to create your first node js application and how to create node js web application. If you have not read it, I am suggesting you to read these two articles. Below are the link of these articles. http://java.gunustories.com/2018/06/create-first-node-js-application.html http://java.gunustories.com/2018/06/generate-node-js-web-application.html After creating a web application, you need to deal with database. So before writing node js script, you need to download and install MongoDB in your PC. To download MongoDB go to the https://www.mongodb.com/download-center?jmp=nav#community link. Before start writing node js database connection, please insure that MongoDB is running in your PC. Now open app.js file and write below configuration to connect with MongoDB. const MongoClient = require('mongodb').MongoClient var db MongoClient.connect('mongodb://localhost:27017/', (er...
Comments
Post a Comment