Java's String class includes the
compareTo() method, which allows for an easy comparison of two strings. This
method returns either -1, 0, or 1, depending on how they compare lexicographically
(dictionary order).
-1 is returned when the string on the left side of the "." is
lexicographically before the string within the parentheses
0 is returned when the two strings are identical
1 is returned when the string on the left side of the "." comes
lexicographically after the string within the parentheses
1 Create two String instances. Let's say you have two strings: myString1 and myString2.
2 Perform a comparison of the two strings. Use myString1.compareTo(myString2) or myString2.compareTo(myString1) in order to get the result.
C is one of the main programming languages used in developing applications for computers. C is a complicated language to learn, but the object-oriented (visual) versions of C that exist--C++ and C#--isolate the user from most of the language details. While a basic grounding in the original C makes it easier to learn Visual C++, some of the routine coding is simplified. This allows for more rapid development of software, as well as better-looking user interfaces.
History
In the very early days of programming, people had to create code using the binary system. This was both slow and extremely prone to error, and resulted in lengthy programs. Languages more suited to humans--such as PL/I, BCPL, COBOL and FORTRA--were quickly developed. In the early 1970s, Ken Thompson, a programmer at Bell Laboratories, created a more powerful language named B. Another programmer at Bell Laboratories, Dennis Ritchie, refined B and called the new language C.
Significance
Eventually, the C language became so popular that it replaced most of the other early programming languages. C's flexibility and portability meant that programs could be written independently, even with no knowledge of the eventual operating system. Continued enhancements of C led to easier-to-use software that was called "object-oriented." C++ is one of these programs. Object-oriented languages enable the programmer to focus on the end result, rather than the minutiae of coding. This is an economic boon, because it speeds development.
Function
The C language is used to create systems that control the operation of computers, as well as in many commercial software programs. Word processing, spreadsheet and database programs are written in C. Whenever massive amounts of data must be crunched or software puts a heavy load on computer processing power, C is the language of choice. Both professional and amateur programmers write in C, although amateurs and some professionals tend to prefer Basic because of its perceived easier approach to application development.
Features
Creating a program in object-oriented versions of C (called Visual C++ in Microsoft's version) removes the drudgery and possibility of coding error in the original C language. Creating a Windows Form (screen) is a matter of selecting and dragging items to put on the form--such as a label, button, checkbox or a more complicated object. That simple act creates many lines of code that control where the label is placed, how it looks and other features of the design. The programmer can concentrate on how the code will display on the screen, rather than on writing multiple lines of coding to accomplish each task.
Considerations
The other main computer language used by programmers is Visual Basic. It takes less time to learn Basic and become proficient in it than it does in the C language. Programmers continue to debate which is better. The current version of Microsoft Visual Basic is in many ways as powerful as C. There are clear distinctions that sway one toward Visual C or Visual Basic depending on the ultimate purpose. Visual Basic has advantages in developing user interfaces, while Visual C can process complicated scientific data faster and more efficiently.
Cracking the Code
To understand binary code, it is important to first understand exactly what the code is and the functions it serves. Binary code is a breakdown of complex language into very simple zeros and ones. For instance, the binary code for the letter "A" is 01000001, the code for "B" is 01000010 and "C" is 01000011.
In essence, binary code is merely a translation of an understandable language into what has come to be known as computer language. While there are many derivatives of binary computer language, each with the goal of presenting enhanced understandability for programmers, all derivative languages are converted into binary code for processing by a computer's CPU (central processing unit).
Implementation
Using a broad perspective, the individual zeros and ones in binary code are predetermined instructions for the processor that reads it. Binary code manipulates a series of circuits into a recognizable pattern of "off" and "on" electrical pathways. This series of circuits might be compared to the teeth of a very intricate key, which produces a specific action from the CPU that has been preprogrammed to understand understand each pattern and respond. As the code is read, zeros traditionally switch a circuit off, while ones switch the next circuit on, until a unique pattern is produced from each code.
Result
The purpose of each binary code, representing letters, numbers and symbols, is to display the translated result on the computer screen. In its simplest form, the binary code in computer language translates into the activation, or lack thereof, of each individual pixel on the computer's screen, eventually determining the shape of each letter -- represented by a series of pixels -- as well as its color, shade and size.
As each pixel becomes its designated color more rapidly than the human eye can detect, a very complex picture is formed, showing the computer's user a single image for a predetermined amount of time. This image is then replaced with the next, and the process continues to produce the illusion of a moving picture and the electronic signals required to transmit sound through the computer's speakers.
Utility
The usefulness of binary code has proven itself throughout the modern world in multitudes of audio-visual technology and communications devices. Because binary code is the basis of electronic communication, this seemingly simple language has radically transformed the modern world into a faster, clearer and stronger technologically based society with virtually limitless possibilities.
Computer technology has evolved to a point where a single core processor can no longer provide sufficient power for today's demanding applications. The solution to this problem was to add cores to multiply the amount of processing power in CPUs.
Benefits
Multi-core technology helps processors keep up with the demands of the newest generation of applications. Such processors can double or quadruple the power of a single-core processor.
What is a Core?
A core is basically a "muscle" in the CPU which receives instructions through binary code at a specific bit width. The more "muscles" the CPU has, the more information it can process at any given moment within one clock cycle.
Function
Each core in a multi-core processor acts like a CPU itself. It receives instructions and performs the tasks necessary to carry them out by seeking through memory or other resources at its disposal.
Misconceptions
There is a common misconception that a slower clock speed makes a processor more efficient. In general, a slower dual core processor is faster than a faster single-core processor because of the fact it can process two tasks at the same time.
Expert Insight
To be able to calculate the true clock power of your processor as compared to its single-core counterpart, multiply the clock speed (the speed in GHz) by the amount of cores you have and compare it to a single-core processor.