C++ supports both implicit and explicit type casting of variables. Error c2664 is displayed while developing C++ when an incompatible conversion is encountered. This can occur if a class is created and an implicit constructor conversion is attempted while an explicit keyword is in the code statement. Type Casting in C++ Converting an expression into another is referred to as “type casting” in C++. The language supports both implicit and explicit type casting. When implicitly converting one variable into another, no operator is required prior to the variables. This is Read More
Binary Tree – Inserting a Node
If the binary search tree is initially empty, then the element is inserted as a root node. Otherwise the element is inserted as terminal node. If the element is less than the element in the root node, then the element is inserted in the left sub tree else to the right sub tree. void insertelement(BST *tree, int element) { BST *ptr,*nodeptr,*parentptr; ptr = (BST*)malloc(sizeof(BST)); ptr->info = element; ptr->left = ptr->right = NULL; if(tree == NULL) *tree = ptr; else { parentptr = NULL; nodeptr = *tree; while(nodeptr != NULL) { Read More
Dijkstra Algorithm
Dijkstra algorithm gets its name from the Dutch computer scientist Edsger Dijkstra who invented this algorithm in 1959. It is used to find the shortest path between two non-negative nodes in a graph. Dijkstra algorithm is widely used for the purpose of routing. For any giving node in a graph the algorithm finds the path which is the shortest from that node to all the corresponding nodes in the graph. As stated earlier also that this algorithm is used to find the shortest path between two distinct nodes on the Read More
Java Method
Java Method is very much similar to a normal method or a function written within a class definition. Java method is basically a set of statements group together to perform a specific task. This method is included in a class. An object instantiated from a class can call methods of that class. Every Java method has a basic structure which must be followed to create any type of method. This structure of a Java method holds the following components: Method Header [Modifiers + Return Value Type + Method Name + Read More
Java Variables
A Java variable is an element that stores a specific type of value. It is commonly declared as a member variable within a class. A variable declared inside a class becomes an Instance variable and his associated to every instance created from that class. That is, every time a new object of that class is created, a new instance of its variable will also be created. Alternately, a Java variable declared inside a method is not an Instance variable. That variable is local to that method only, thus the name Read More
What is PLC Programming?
PLC (Programmable Logic Controller) programming allows a computer to automate mechanical or electrical processes for machinery, lighting, or assembly line control actions. Over the past two decades, PLC programming has been used in a number of industries. The PLC’s design allows it to take multiple inputs and provide various outputs. A PLC device is also referred to as a hard, real-time control system since its output(s) is in direct response to input conditions within a pre-arranged time frame. History of PLC Programming PLC programming was invented to address the U.S. Read More
NoClassDefFound
NoClassDefFound means “No Class Definition Found”. NoClassDefFound is an error from the JVM when it cannot find a class required to run a Java program. This error could be caused by an actual missing class, but it is usually caused by a faulty CLASSPATH. This error also sometimes occurs when Java users add the unnecessary .class extension to the end of their command lines: C:>java HelloWorld.class Exception in thread “main” java.lang.NoClassDefFoundError: HelloWorld/class C:>java HelloWorld Hello World!
Java Applet
An Applet is generally a small application module that is developed to perform one specific task and it runs under the umbrella of another bigger application. In other words, an Applet often acts as a plug-in which can easily be integrated into a suitable application. Similarly, Java Applet is a small module written in the Java programming language which can be injected into any webpage to perform a specific task. The origin of the word “Applet” was first noticed in PC Magazine, 1990. Java Applet is run in a Java Read More
How to Declare a Constant in Java
Java does not directly support constants. However, a static final variable is effectively a constant. The static modifier causes the variable to be available without loading an instance of the class where it is defined. The final modifier causes the variable to be unchangeable. Naming Standards for Java Constants Java constants are normally declared in ALL CAPS. Underscores normally separate Words in Java constants. Sample Java Constant Declaration public class MAX_UNITS { public static final int MAX_UNITS = 25; Vedios Related to Java Constant Declaration
Deleting an Element from a Doubly Linked List
To delete an element from the list, first the pointers are set properly and then the memory occupied by the node to be deleted is deallocated (freed). Deletion in the list can take place at the following positions. At the beginning of the list At the end of the list After a given element Before a given element Deleting from the Beginning of the List An element from the beginning of the list can be deleted by performing the following steps: Assign the value of head (address of the first Read More
Share on: