Posts

NetBeans For Java How To Install and Get Started with Java Programming (on Windows)

NetBeans (@ http://netbeans.org ) is an open-source Integrated Development Environment (IDE). NetBeans began in 1996 as a Java IDE student project at Charles University in Prague. Sun Microsystems acquired NetBeans in 1999. In 2010, Oracle acquired Sun (and thus NetBeans). Compared with its rival Eclipse ( http://www.elicpse.org ) (both are open-source, so I don't know what are they competing for?), NetBeans provides seamless support for Java AWT/Swing, Java ME mobility pack, Java EE, and bundled with an excellent profiler for performance tuning. How to Install NetBeans 8.2 Step 0: Install JDK To use NetBeans for Java programming, you need to first install Java Development Kit (JDK). See " JDK - How to Install ". Step 1: Download Download "NetBeans IDE" installer from http://netbeans.org/downloads/index.html . There are many "bundles" available. For beginners, choose the 1st entry "Java SE" (e.g., " netbeans-8.2-javase-windows.exe ...

Example to connect to the mysql database in java

For connecting java application with the mysql database, you need to follow 5 steps to perform database connectivity. In this example we are using MySql as the database. So we need to know following informations for the mysql database: Driver class: The driver class for the mysql database is com.mysql.jdbc.Driver . Connection URL: The connection URL for the mysql database is jdbc:mysql://localhost:3306/sonoo where jdbc is the API, mysql is the database, localhost is the server name on which mysql is running, we may also use IP address, 3306 is the port number and sonoo is the database name. We may use any database, in such case, you need to replace the sonoo with your database name. Username: The default username for the mysql database is root . Password: Password is given by the user at the time of installing the mysql database. In this example, we are going to use root as the password. Let's first create a table in the mysql database, but before creating table, we need t...

Why Magic numbers are bad? [JAVA TIP]

Hey guys, today I'd like to share a tip about "How to avoid magic numbers in your code". Let's look at the first code snippet: float getScaledPageWidth(float zoomRation) { return zoomRation * 210; } And here is the updated version: static final float A4_PAGE_WIDTH = 210;   float getScaledPageWidth(float zoomRation) { return zoomRation * A4_PAGE_WIDTH; } Do you know what the differences? Can you guess what was improved? And remember to share with your friends if you want them know tip too. I bet they will be thankful you.

How to compare strings correctly [JAVA Tip]

The main objective of this post is to explain the correct method of comparing the strings in Java. Can you answer the following quiz?  * QUIZ: Guess output of the following code snippet: String osName = System.getProperty(“osName”); if (osName.equals(“Windows”)) {        System.out.println(“You’re using Windows”); }   For now, let write down your answer on paper. I will let you know the correct answer at the end of this post. Friends, why I want you to answer the quiz above? Well, it’s because I’m going to share a tip about Strings comparison today. * Why Strings comparison? It sounds very simple, but do you know that you have to compare Strings in every coding day of your entire life? Unless you die or you don’t coding any more, comparing Strings is your day-to-day chore, like you eat and drink. I want to tell you about the comparison of a String variable against a String constant as shown in the code snippet above: String osName = System.getProp...

How to run Java program from CMD

Let's say your file is in C:\mywork\ Run Command Prompt C:> cd \mywork This makes C:\mywork the current directory. C:\mywork> javac filenamehere.java This runs javac.exe, the compiler. You should see nothing but the next system prompt... C:\mywork> dir javac has created the filenamehere.class file. You should see filenamehere.java and filenamehere.class among the files. C:\mywork> java filenamehere This runs the Java interpreter. You should then see your program output. If the system cannot find javac, check the set path command. If javac runs but you get errors, check your Java text. If the program compiles but you get an exception, check the spelling and capitalization in the file name and the class name and the java HelloWorld command. Java is case-sensitive!

How to Install the Java Software Development Kit (JDK)

Image
Before you can create and modify Java programs, you’ll need the Java Software Development Kit. You can download the kit (also known as Java SDK or JDK) for free from Oracle as a single installer file, which makes installation quick and easy. Learn the best way to download and install the Java Software Development Kit on your Windows, macOS, or Linux system. PART 1. Step 1.  Downloading the Java Software Development Kit Navigate to http://www.oracle.com/technetwork/java/javase/downloads/index.html . You can download a simple Java Software Development Kit (JDK) installer for Windows, macOS, or Linux directly from Oracle. Step 2.  Click the “Download” button beneath “JDK. ” This will open a new page containing several download options. Step 3.  Scroll to the latest version of Java SE Development Kit. You should always use the latest stable version of the toolkit. There may be more than one version listed, so look closely at the release number. For example, if you are presented with JD...

Having problems!!!!!

Hey friends, I know all of you are studying, learning new languages, gaining technical knowledge etc. Some of having problems like programs are not running due to errors in C, C++, JAVA etc. Or don't understanding some topics because of high level definitions. Actually we also suffer from that, that's why I am presenting here this post for you, so that you can ask about problems, you'll get your solution in atmost 24 hours. Fill the contact form given below or you can just comment at this post.   [contact-form subject="Problem Request from Tech Blicks"][contact-field label="Name" type="name" required="1" /][contact-field label="Email" type="email" required="1" /][contact-field label="Problem Related to" type="select" options="C,C++,JAVA,IWT,Microprocessor,Data Structure,Computer Hardware,Others" required="1" /][contact-field label="Comment" type="text...