DEV Community

Cover image for Building My First Projects with Java!
Kenneth M. Colón Pagán
Kenneth M. Colón Pagán

Posted on

Building My First Projects with Java!

Coming from the Flatiron Bootcamp, I have been exploring different programming languages out there to keep my wheels turning. Especially in this programming world where things are always changing and evolving, my passion for learning fuels my drive.

I have found myself enjoying Java and have decided to start building CLI projects. Alongside a Java course, I built 3 Projects this week: an email administration application, a student database application, and a bank account application. One thing is watching videos and reading articles but the best way to learn a new language, personally, is by building a project to see all the puzzle pieces come together!

In these projects, concatenating seemed to be my best friend. In Java, using the "+" provides a concatenation operator, you can directly add two String literals. A great example is when asking a user for input and printing it back out with some added text:

Scanner in = new Scanner(System.in);
        System.out.print("Enter your name: ");
        String name = in.nextLine(); //Input: Ken
        System.out.print("Welcome, " + name + "!");
//=> Welcome, Ken!
Enter fullscreen mode Exit fullscreen mode

Something to remember when using the "+" operator, is that spacing is not included so it is best to include it before closing the double quotation mark.

A great escape character to use when displaying this data, and have it organized is 'newline' => "\n". This also comes in handy when printing out multiple lines, it can show you what it will look like before it prints out.

// void means this method doesn't return a value
 public void showInfo(){
      System.out.println(
              "Name: " + name +
              "\nAge: " + age +
              "\nShoe Size: " + shoeSize 
      );

//=>   Name: Ken
//     Age: 20
//     Shoe Size: 10
Enter fullscreen mode Exit fullscreen mode

I am now working on implementing a CSV file reader for my banking project. Knowing there is always something you can improve or add to my project, or simply start a new one, is the reason I love what I do and why I can't picture myself doing anything else!

Latest comments (0)