Input, Output & Variables – Java tutorial for beginners

Hi guys, Otto Fischer here and welcome to my third blog post!

Today I will show you the basics of the Java programming language.

VARIABLES

The variables in Java are exactly the same as in C++: int (integer-for whole numbers), double or float (you can use any number, decimal numbers as well), char (for characters), String (for words) and boolean (boolean-whether true or false) .

Careful! If you declare an ‘a’ as an integer (int a), you won’t be able to give him a string, double or char value. Surely, you can give them some values too.

For instance:

OUTPUT

There are several ways in which you can print something out. You have to work with functions that are already written.

For instance:

Because the programmers are just some lazy animals, you just have to type “sout” in Netbeans and press the Tabulator and automatically will appear the “System.out.println();” statement.
You can use the “System.out.printf();” statement if you want but you must know that you will have some restrictions. It doesn’t allow you to go to the next line and everything will be printed in the same line. (I highly recommend to use the first one to get an esthetic result 🙂 )

So let’s make a little program:

We will have two numbers and we are going to declare them to set a value for them and to print out their sum. (we have to do everything in the main function: “public static void main(String[] args)”  )

We can also do that:

This code will print out: The sum of the two number is: 11
Quite interesting, isn’t it?

 

Android IOS Freebie Web Development Erdely Transylvania Affarit Studio Targu Mures Brasov Sibiu Cluj Programator

Two more things:

  1. Make sure that you’ve put ‘;’ after each line and remember that the text after the slashes means that they are comments.
  2. The comments doesn’t influence the code you’ve written but it could help to precise what you are about to do.
INPUT

Input means that you are able to type in values from the keyboard. First of all, you have to import a library called “java.util.Scanner” and then we will tell Java that we need to use the scanner which will enable us to get information from the keyboard.

Let’s see an example:

What we did is that we created a scanning variable called affarit and this variable will get the information from the keyboard. Whatever you type in, it will be equal with the “affarit” variable. Everything you want to type in should be entered down at the output window like this:

Android IOS Freebie Web Development Erdely Transylvania Affarit Studio Targu Mures Brasov Sibiu Cluj Programator

Hit enter! Then the code will print out that variable. For instance if we type in: “Hello World”, in the next line will appear the “Hello world” once again.

Android IOS Freebie Web Development Erdely Transylvania Affarit Studio Targu Mures Brasov Sibiu Cluj Programator

Make sure you will watch the tutorial video. I’m sure that you will understand it better afterwards.

If you want to type in two decimal numbers, for instance, and you want to calculate their sum you have to print it out as shown:

The basic calculator will be a perfect example for that.

BASIC CALCULATOR
Okay guys I know that this may look a bit difficult but it isn’t. We have started exactly the same way we started the INPUT code. We imported the java.util.Scanner and then we made an “affarit” variable to be able to get values from the keyboard.  We gave to the firstNumber and to the secondNumber values and we calculated their sum and printed it out.

Android IOS Freebie Web Development Erdely Transylvania Affarit Studio Targu Mures Brasov Sibiu Cluj Programator

Well guys, that’s it for today. See you soon with more interesting stuffs.

Cherees,
Otto.

Setting up the JDK & the NetBeans IDE

Hello everybody!

Today I’m going to show you guys how to download, install and set up the JDK and the Netbeans platform. But, first of all I’d like to explain what they mean.

 

The Java Development Kit (JDK) is an implementation of either one of the Java Platform, Standard Edition; Java Platform, Enterprise Edition or Java Platform, Micro Edition platforms released by Oracle Corporation in the form of a binary product aimed at Java developers on Solaris, Linux, Mac OS X or Windows.

The JDK includes a private JVM and a few other resources to finish the development of a Java Application. Since the introduction of the Java platform, it has been by far the most widely used Software Development Kit (SDK). On 17 November 2006, Sun announced that they would release it under the GNU General Public License (GPL), thus making it free software. This happened in large part on 8 May 2007, when Sun contributed the source code to the OpenJDK.

 

NetBeans is a software development platform written in Java. The NetBeans Platform allows applications to be developed from a set of modular software components called modules. Applications based on the NetBeans Platform, including the NetBeans integrated development environment (IDE), can be extended by third party developers.

The NetBeans Platform is a framework for simplifying the development of Java Swing desktop applications. The NetBeans IDE bundle for Java SE contains what is needed to start developing NetBeans plugins and NetBeans Platform based applications; no additional SDK is required.

NetBeans IDE is an open-source integrated development environment. NetBeans IDE supports development of all Java application types (Java SE (including JavaFX), Java ME, web, EJB and mobile applications) out of the box.

 

In the tutorial video (at the end of this post), we are going to set up the Netbeans. Please pay attention to every step of it. After setting it up you will face a screen like this right above:

 

Android IOS Freebie Web Development Erdely Transylvania Affarit Studio Targu Mures Brasov Sibiu Cluj Programator

Right now, we are going to click on the “File” (top left corner) and after that on “New project”.

 

Android IOS Freebie Web Development Erdely Transylvania Affarit Studio Targu Mures Brasov Sibiu Cluj Programator

At the next step, a screen window will appear, where you have to set up all the basic information, for your project.

Android IOS Freebie Web Development Erdely Transylvania Affarit Studio Targu Mures Brasov Sibiu Cluj Programator

Here you have to choose the Java folder and then “Java Application”. Careful! You won’t be able to do that if you don’t set it up like I did in the video. Next, click on the “Next” button.

 

Android IOS Freebie Web Development Erdely Transylvania Affarit Studio Targu Mures Brasov Sibiu Cluj Programator

Enter a random name for your project and finish the settings.If you did exactly like me, you’d be able to code in your very first Java project. I’m already proud of you guys. 🙂

 

Android IOS Freebie Web Development Erdely Transylvania Affarit Studio Targu Mures Brasov Sibiu Cluj Programator

That’s how it looks like. Please follow with attention the tutorial video down below:

https://youtu.be/DiMj9IiVsjU

 

Stay tuned for more of java, till then check our tutorials and don’t forget to subscribe to be the first to get all the important information we publish in our journal. We don’t like spamming and we know that you don’t like it, also. Subscribing to us, you will be privileged by receiving only valuable materials.

              Cheeres,
Otto

 

Introduction in to Java Programming & NetBeans

Hello everybody!

First of all I would like to introduce myself! My name is Otto Fischer and I’ve started learning programming 3 years ago, at my school. I began learning C++ with my classmates and at the beginning I didn’t really like it. But a year later, my school grades at computer science increase and I really felt that programming is one of my passions.

One day I met Ferencz Andras (the CEO of Affarit Studio and one of my very good friends) and he showed me some really serious stuffs about programming. Two months later I’ve started to learn the Java programming language and I really enjoyed it. Now, I’m learning to code in Android Studio but it requires a lot of knowledge (for instance: you can’t do anything there if you don’t know a little bit of Java).

One day, Andras came up with the idea of writing a blog post about the Java Programming Language (in NetBeans) so I suggested to make some tutorial videos about it also.

It seems that it will be fun with you guys, so please stay tuned!

But, what does Java programming language mean?

Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers “write once,run anywhere” (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. As of 2016, Java is one of the most popular programming languages in use, particularly for client-server web applications, with a reported 9 million developers.

The latest version is Java 8, which is the only version currently supported for free by Oracle, although earlier versions are supported both by Oracle and other companies on a commercial basis.

My personal opinion…

I think that Java is one of the easiest programming languages. There are so many keywords out there, but a lifetime won’t be enough to learn all of them. I will give you a tip on how to make Java look way easier, though: coding in NetBeans. I know I’ve made you curious about that, so don’t worry, I will explain this much clearly in my video tutorials.

I also think that Java is similar to C++. The code is a bit different tought, in Java you have to do everything in classes with objects and so on and last but not least you can do way more things in Java. For instance:

In my opinion the GUI (Graphical User Interface) is the most interesting part of Java. On the tutorial videos that I have prepared for you guys I will show you the basics, the GUI and after going thru all this, together we will create an Instant Messenger with a server in Java.

I think that’s enough for today. In the next blog I will show you guys how to install Java JDK and Netbeans and how to set up them.

See you then! 🙂
Otto

Setting up the Xcode IDE for iOS development

Welcome back dear readers!

So glad to see that you are interested in setting up the Xcode IDE for iOS development. If you haven’t get the chance to read our previous article, which brings you a little bit closer to the beautiful world of Apple programming, just click here to catch up. I promise will be 100 times easier to go thru this tutorials and to understand it.

Today, we are going to see the very basics of the Xcode environment. First of all, you have to download and install it.(click here to download ) You need a PC / Mac  that runs OS X 10.11.5 or later.

ios tutorial android xcode targu mures cluj romania affarit studio programator

When you start the IDE you will face a screen like above. Right now, we are going to click on the  “Create a new Xcode Project”. Later on, we’ll explain how to use the other sections too.

ios tutorial android xcode targu mures cluj romania affarit studio programator

At the next step, you’ll have to select what kind of application do you want to create. Select the “iOS” section, and choose “Single View Application”.  After that, a screen will appear, where you have to set up all the basic information, for a project. Type something like “tutorial” and you are ready to go.

ios tutorial android xcode targu mures cluj romania affarit studio programator

Select the Objective-C programming language, and set the Devices section to “Universal”. Click next, select a folder for the project and finish the setup.

ios tutorial android xcode targu mures cluj romania affarit studio programator

This should should be the screen that you need to see. I know that there are a lot of things but don’t worry, we will go thru step by step together. Nice and slow.

ios tutorial android xcode targu mures cluj romania affarit studio programator

Firstly, you will see the files and the project hierarchy at the left part. There will be a some .h and .m files. Open the ViewController.m

 

 

 

 

 

ios tutorial android xcode targu mures cluj romania affarit studio programator

In this section you see the very basics of a controller. It has 2 methods, the first is the viewDidLoad method, which is called by the system, after creating the view.

Next, browse the Main.storyboard and click on it. This is the interface where you will be able to design your application. Currently is empty the screen. I added a textView (I will explain this one in the next post).

ios tutorial android xcode targu mures cluj romania affarit studio programator

 

Look around and play a little bit with the idea. In the next posts we are going much deeper and we will see how to design and setup a simple screen.

If you have any idea, thoughts or suggestions on how/or what to detail more in the next posts or you want to share some knowledge with the others just let me know.

Also, as always, do not forget to subscribe, to be the first who will receive all the goodies we post day by day.

 

All the best,
András

A brief introduction to iOS programming

I think everybody in this country should learn to program a computer. Learn a computer language. Because it teaches you how to think” – Steve Jobs

Hello, dear readers!

In this post I would like to introduce you into the world of iOS. You will read about the history of the operating system and about the basic programming requirements.

iOS (originally iPhone OS) is a mobile operating system created and developed by Apple Inc. and distributed exclusively for Apple hardware. It is the operating system that presently powers many of the company’s mobile devices, including the iPhone, iPad, and iPod touch. It is the second most popular mobile operating system in the world by sales, after Android.

Originally unveiled in 2007, for the iPhone, it has been extended to support other Apple devices such as the iPod Touch (September 2007), iPad (January 2010) and iPad Mini (November 2012).

Image: businessinsider.com

The SDK was first released on March 6, 2008, and allows developers to make applications for the iPhone and iPod Touch, as well as test them in an “iPhone simulator”.

In iOS, there are four abstraction layers: the Core OS layer, the Core Services layer, the Media layer, and the Cocoa Touch layer.

Core Foundation (also called CF) is a C application programming interface (API) in Mac OS X & iOS, and is a mix of low-level routines and wrapper functions. Internally, Core Foundation forms the base of the types in the Objective-C runtime as well.

The Foundation Kit, or just Foundation for short, is an Objective-C framework in the OpenStep specification. It provides basic classes such as wrapper classes and data structure classes. This framework uses the prefix NS (for NeXTSTEP, or NeXT/Sun). The Foundation Kit is in the Cocoa Touch API.

Cocoa Touch is a UI framework for building software programs to run on iOS, WatchOS, and tvOS. This framework provides an abstraction layer of iOS, the operating system for the iPhone, iPod Touch, and iPad. Cocoa Touch is based on the Mac OS X Cocoa API toolset and, like it, is primarily written in the Objective-C language. Cocoa Touch allows the use of hardware and features that are not found in Mac OS X computers and are thus unique to the iOS range of devices. Just like Cocoa, Cocoa Touch follows a Model-View-Controller (MVC) software architecture. Cocoa Touch contains a different set of graphical control elements to Cocoa. Tools for developing applications based on Cocoa Touch are included in the iOS SDK. Defines the basic application infrastructure and support for key technologies.

Reading Mobile Development Books Android IOS Targu Mures Cluj Napoca

In order to create easily iOS apps, you have to download the Xcode from the Mac App Store. Xcode is an integrated development environment (IDE) containing a suite of software development tools developed by Apple for developing software for OS X, iOS, WatchOS and tvOS.

Xcode supports source code for the programming languages C, C++, Objective-C, Objective-C++, Java, AppleScript, Python, Ruby, ResEdit (Rez), and Swift.

In the upcoming period we are going to use this IDE for our sample projects. In the next post, we are going to see how can we create a simple hello world application for the iPhone.

Till then you may check the goodies that we have prepared for you: 6 Free Mobile Development Book that you must read.

Also don’t forget to subscribe to be the first to get all the important information we publish in our journal.

P.s: We don’t like spam too. 🙂

   Wishing all the best,
                 András Ferencz