Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Methods



  Polymorphism in OOP programming

Polymorphism is the capability of an action or method to do different things based on the object that it is acting upon. This is the third basic principle of object oriented programming. Overloading, overriding and dynamic method binding are three types of polymorphism. Overloaded methods are methods with the same name signature but either a different number of parameters or different types in the parameter list. For example 'spinning' a num...

   Java,OOP,Polymorphism,Overloading,Overri     2014-10-23 08:11:50

  How many Java programmers are there in the world?

Oracle says its 9,000,000, Wikipedia says its 10 million, NumberOf.net gives the exact number of Java programmers, 9007346.But how many Java programmers are there really? We cannot call everyone on the planet to ask whether he/she is a Java programmer or not.So we can only rely on some indirect methods to estimate, such as government statistics (There are around 43 million programmers in the world), TIOBE and Langpop, Employment portals, Eclipse and Tomcat download numbers.Download number of Ecl...

   Java programmer,number     2012-07-20 11:57:19

  Should we use Abstract class or Interface?

When we write programs, we may often get into a situation where we don't know whether we should use Abstract class or Interface when we want to define an abstract object. These two are very similar and they are interchangeable in many cases. On Stackoverflow, this question is asked lots of times and it's related to many programming languages. Also in the official documentation of PHP regarding the Abstract class and Interface, people are arguing about this. To understand this question, their dif...

   DIFFERENCE,INTERFACE,ABSTRACT CLASS,COMPARISON,OOP     2013-04-15 11:44:36

  ByteBuffer in Java

ByteBuffer is introduced in java.nio since Java 1.4. It provides a way of representing raw structured data such as from a file or from network. It enables fast access of underlying data compared to traditional ways like byte[] Prior to Java 1.4, if you want to represent a structured raw data, you need to create a byte[] and then having a set of checks to delimit the byte array to get the expected tokens. There are three ways to create a ByteBuffer: Wrapping an exiting array by calling ByteBuffe...

   JAVA,BYTEBUFFER,ALLOCATION     2015-07-08 03:17:44

  Solve Hibernate "Too many connections" issue in MySQL

When working with Hibernate and MySQL, sometimes some exceptions will be thrown after sometime. The exception may seem like : java.sql.SQLException: Data source rejected establishment of connection, message from server: "Too many connections" This means there are too many active connections on the MySQL, you can use SHOW STATUS LIKE '%Threads_connected%'; to check the active connections to MySQL. If you want to change the maximum connections allowed to MySQL. You can execute: set global max_co...

   MySQL,Hibernate,Clos     2013-09-04 22:20:49

  What is the use of empty struct in GoLang

In Go, an empty struct struct{} is a struct with no fields that may appear to be of little use, but in reality, it can be useful in certain situations and become a simple and efficient solution in code. As a semaphore or lock Because the empty struct has no fields, it can be conveniently used to implement some concurrency control functions, such as mutex locks, read-write locks. We can use chan struct{} to implement an unbuffered channel for controlling concurrent access. package main import ( ...

   GOLANG,EMPTY STRUCT     2024-04-05 23:54:03

  Understanding GoLang interface

If goroutine and channel are considered as the foundation for GoLang concurrency, interface would be the key for data types in GoLang. In practical Go programming, almost all data types are built/used around interfaces, interface is the core of GoLang data structures. Go is not a typical OOP language, it has no class and inheritance concept syntactically. But it doesn't mean that there cannot be polymorphism in GoLang. Because of interface, it achieves the same polymorphism effect as in C++, tho...

   INTERFACE,GOLANG     2021-05-15 04:16:42

  Understanding abstract interface in Java

Have you read about an interface declaration as public abstract interface InterfaceName in Java? At the first glance, is it a weird declaration? Why should we declare an interface as abstract? For example, we may see below code in some projects: public abstract interface MyInterface { public void check(); public abstract boolean check(boolean really); } Actually here abstract is redundant, an interface is implicitly abstract, we no need to put an abstract in front of interface. But it do...

   Java,abstract interface     2014-08-18 23:07:27

  PHP to output string to client terminal

It is a common task to echo messages to the user using PHP. There are lots of ways where the message can be echoed to the client terminal(browser or console window) through PHP. These includes some well know debug methods like var_dump() and var_export() etc. In this post, we will show you some other methods shared by Laruence, one of the core members of PHP development team. 1. echo First comes with the most common one : echo. $str = "Hello PHP\n"; echo $str; 2. print Then comes another c...

   TRICKS,DEBUG,OUTPUT,PHP     2015-10-01 03:16:56

  Java Polymorphism and Overriding Methods

Most Java developers will be familiar with polymorphism – we’ve all seen the example of the Dog and Cat classes inheriting from some abstract Animal class and having their say() methods produce different results. But it’s still worthwhile to look at a few simple examples to reinforce the concepts.First, we define a simple class with one instance method and one static method.public class A { public String getName() { return "I a...

   Java,Overriding,Polymorphism,Demo,Dynami     2011-10-04 14:09:06