Category Archives: Java

Why to use C# and when to prefer other languages?!

Introduction and Background

Either it is Quora, or is it C# Corner or is it CodeProject, beginners and novice users are always asking questions like, “Which one to use, C++ or C#?”, and many more similar questions. It is harder to provide an answer to such questions on multiple platforms and to multiple questions. That is why, I thought, why not post a blog post to cover most of the aspects of the question. In this post I am going to cover a few of the concepts that you may want to understand to chose either language from the most widely used languages:

  1. C or C++
  2. Java
  3. C# (or .NET framework itself)

Basically, my own preference in many cases is C#, but that depends on what I am going to build. I have been using C, C++, Java and C# in many applications depending on their needs, depending on how they allow me to write the programs and depending on whether it is the suitable programming language for this type of project and application architecture.

The way, I do that, is just a trick. Which, I am going to share with you, in this blog post. Among these a few of the very basic things to consider are:

  1. How simple and easy it would be to use this language in the program?
  2. What is the productivity of that language in your scenario!
  3. Difficulty level and how many people know the language!

I will be talking about these things points in this post, so to make it clear where to use which programming language. But my major concern in this post would be to cover the aspects of C# programming language.

Productivity of language

First thing to always consider about the language is the productivity that a programming language can provide your team with. Productivity of the language depends on many factors, such as:

  1. How programs are built in that language?
  2. How fast and reliable is it to build the project regularly?
  3. Is the program’s source code readable for other members on the team?
  4. Is the language itself suitable for the case that we are going to use it in.

Productivity of the language, in my opinion, is the first thing to consider as the valid candidate to always discuss in the team and not just talk about in a black room. You should manage to get your teams up in a conference room, and then talk about a language. There may be many aspects where one language may fall short and other may get well. There would be many factors that most of the programmers don’t know but talking about them one of the geek would stand up and raise another important point that may guide your team to walk on the correct paths to build greater applications.

Let’s talk a bit graph.

Figure 1: Productivity graph of most widely used programming languages.

In this chart we can see that C is the most productive programming language, of which we are interested in; C, C++, Java and C#. C++ and C# are competing with each other, whereas Java is a bit behind than C# and so on.

In the above graph, it is clear that C# is an average programming language. The average doesn’t mean it is below the requirement. But it means that it can be used in any case, and its performance won’t fall as the data increases. The successful run graph shows that C# programs are much successful in many cases. That is why, in many cases, C# proves to be the valid candidate in many cases, since it is a general purpose programming language.

Then the question arises, “Productive in which sense?

That is the most important part here. Now, this topic may take a bit more of the time to explain how productive a language is. For that, I have dedicated the topic, “Choosing the right language for the right task“. The right programming language for the right task would always help you to elevate the speed of the programming of your team! But among other aspects, the most important ones are:

  1. What sort of project this is?
    • Of course you don’t want to use knife to unscrew a screw.
  2. What are the IDE and compilation tools present?
    • Even a program written in C can go wrong if compile is buggy or inefficient.
  3. How your team would like to manage the projects?
    • Does the language support good software engineering concepts?
    • Can it be used to generate good diagrams: Use-case, activity, class and other diagrams.

Thus, you should always consider thinking about the productivity of your development team while guessing which language to be used.

Choosing the right language for the right task

It is always stated to use the best tool for the best jobs! Then, why not use the best programming language for your projects, to get the best possible results? Before I continue any further, there is one thing I want to mentioned… “There is no best programming language ever built.” Every time a programming language is built for a purpose, another group of programmers jump in to create a new programming language, for the sake of fixing the errors in the previous language. What do you think motivated Bjarne to create C++ when there was C language and Scala already in the market?

In this section, there are many things to consider, from the performance and benefits to the clients, to the perk packages for the employees to the efficiencies of the project repositories and the tools provided for that programming languages.

C# was created by Microsoft and therefore, in my opinion, has, by far, the most efficient tools for programming. I mean, Visual Studio, alone is the beast in this game.

Figure 2: Visual Studio logo.

I am a huge fan of Visual Studio, and i would doubt someone who isn’t a fan of Visual Studio. C# has a better support and benefit of using the best IDE out there. Java has also a number of IDE, so does C++ and many of the C programs are written in minimal environments, like a small program to manage and compile the C programs; no offence geeks!

Figure 3: Graph of performance to safety ratio.

Now, if you look at this graph, it’s pretty much clear as to what it is trying to guide you with. Of course, as I had mentioned in the starting paragraph here, that there is no best programming language.

In many cases, C# and Java rule over C++ (and C) and in many cases, they rule over C# and Java. There are many factors, like the programming paradigms, performance of the code that is generated; Just-in-time compilation, memory-management delay and so on. While C# and Java may provide the best environment to build “managed” programs in, there are many cases where C# and java don’t work well, like writing a low-level program. Java developers wanted to build a Java OS, but they had to give up because something’s aren’t meant to be done in Java. 🙂

Always consider to search before making the final call. There are many companies working in the similar field that you are going to work in. There would be many packages and languages built for your own field that may help you to get started in no time!

Figure 4: Top 10 programming languages.

But, I think these are a bit backwards. I think, C is on the top because it causes a lot of trouble to beginners, so everyone is searching for “How to do {this} in C” on Google, raising the rankings. 😉

Selecting the best framework

I don’t totally agree with people when it comes to talk about frameworks like, Java, Qt (which I do like in many cases; like Ubuntu programming), and other programming frameworks available for programming applications to be run despite the architecture of the machine. In this case, my recommendation and personal views for .NET framework are very positive. As, already mentioned, I have programmed on Qt framework for Android, Ubuntu and Linux itself. It was a really very powerful framework to build applications on. But the downside was it was tough to learn, their compilers were modified, their C++ was tinkered.

While selecting the best framework for application development by choices are below:

  1. How much flexible a framework is?
  2. What language does it support?
    • Some frameworks support multiple languages, like .NET framework, it supports C#, VB.NET, Visual C++, JavaScript applications.
  3. Is it cross-platform?
  4. If not cross-platform, then does it support multiple architectures, at least?

Java framework is cross-platform, and entirely framework oriented. You simply have to target the framework despite the operating system or architecture being used. .NET framework on the other hand is a very beautiful framework to write applications on. It uses C#, VB.NET and C++ (no Java!) to write the applications, and then the compiled binaries can be executed on many machines that can support .NET framework. This provides an excellent cross-architecture support.

C# however, does not support Mac OS X, at the moment. Microsoft has started to roll out cross-platform binaries for C# programs. .NET Core has been a great success and once it gets released to a public version, I am sure most of the companies would start to target it. That is not going to happen, in a near future. In which case, Java and C++ are better than C#.

If you are interested in C# programming on multiple platforms, consider using Mono Project instead. You can read about that, on my blog here: Using C# for cross-platform development.

Figure 5: Top languages and their platforms of usage.

Java may be supported 100% in the rankings, but C# is also supporting multiple platforms and is rapidly growing making the language better than the rest. With the release of C# 6, Microsoft has proved that the language is much better than the rest in the race. There are many features that I like C# 6:

  1. String interpolation
  2. Getter-only auto-properties as lambdas
  3. Improvements to lambdas

There are a few things Java still doesn’t have. For example, one statement code to write the data to the files and to extract the data. You have to get messy in the streams, or you have to write an entirely non-intuitive code with Files object and then to get the data from there… Yuk!

Performance of the compiled code

Writing the source code may be different in many ways:

  1. Syntax of the programming language.
  2. The way their objects and procedures are imported in the source code.
  3. How clean the source code looks. Many programming languages are just nightmares.

But the major concern comes to mind when we are going to execute the programs. In many cases, or should I say in all the cases, the language which are bytecoded languages, lag behind than the languages that are compiled to native codes or Assembly codes. For example, C or C++ codes are faster, because they are not compiled to a bytecode instead they are generated as machine codes for a platform or architecture. C# or Java programs are compiled down to a bytecode which causes a JIT to occur when the programs are executed. This takes time.

However, you can see the following charts from and see for yourself, the way bytecoded languages are similar and how much compiled languages are different, see for yourself.

Figure 6: Mathematical calculations.
Figure 7: Pattern matching and machine learning.

Which makes it pretty much clear, how much compiled language are faster than bytecoded, and then come the ones that are interpreted, like Ruby.

In many cases, there are other factors too, which cause bad performance:

  1. Bad compiler.
  2. A lot of resources being allocated.
  3. Slow hardware resources; bad combination of CPU, RAM and other peripherals.
  4. Bad programmer and bad code being used.
  5. Bad practices of programming.
  6. Keeping CPU halted for most of the times.

Much more are a valid candidates for the halting processes.

Finally… Final words

As I have already mentioned that there is no best programming language out there. One language is best in one case, other is best in another case and so on and so forth. In such cases, it is always better to communicate with your development team and then ask them questions and ask for their feedbacks. Choosing the good tools for your projects is always a good approach and good step in the process of programming.

If your software engineer or software architect are trying to find a good solution, ask them to work on the following questions:

  1. What are the teams and developers qualified for?
    • Asking a team of C++ programmers to leave C++ and join Java or C# programming teams is not a good idea!
    • Always consider the best approach.
    • Time is money — Manage it with care.
    • Recruit more programmers with skills.
  2. Is the programming language long lived, or a minor one?
  3. Is programming language capable of making your application work?
    • I have used many programming languages, and thus I can decide which language to use. This is the job of your software architect to decide which languages to select.

If you follow these rules, you will save yourself from many of the future questions that cause a lot of problems. Many times developers ask questions like, “I have an application in Java, how to migrate it to C#?” Many web developers ask questions like, “I have a PHP application, how to convert PHP code to ASP.NET?” These questions have only answer. “Re-write the applications”.

There are many things that you should consider before designing the applications. Facebook is stuck with PHP, because it was written in PHP. Even if they wanted to migrate to ASP.NET, they won’t. Instead, they have found a work around the PHP bugs and downsides.

This is why, you should always consider using a conference or meeting to decide how to start the project, which programming language to use, what frameworks to target, who would lead the team and much more. These few days of discussion and designing would save you a lot of money and time in future.


Cross-platform programming: An open-source overview

Since past few months, I have been very active in cross-platform environment and open-source programming frameworks and operating systems. I have found many great tools, many things caused me some troubles, many things needed some experienced vision and some things were pretty much obvious. I find it interesting that open source community is a great community and people who actually share their experience have much more knowledge than any of the individual present in a proprietary software owning company. The reason is simple, the members of an open source community are:

  1. Open and always welcoming new ideas.
  2. They share their experience.
  3. They are welcoming the negative comments on their experience.
  4. They are not looking forward for any thing to be repaid with.
  5. They enjoy programming and they like to “solve puzzles”. Most open source contributions are solutions to “real world” problems.

In this article of mine I am going to focus on the aspects of cross-platform programming and open source community impacts, that make the regular day programming even better! If you are a programmer, I would love to recommend that you take a trip to open source community and enjoy a few days off for cross-platform development. Programming itself is not just about C#, Java or Python. There are many programming languages, markup languages, compilers and tools already available in the outside world that you would love to use and get your hands dirty in.

When I started programming, I always thought that I am never going to leave this one framework. But as I started learning stuff, I enjoyed them. I really enjoyed using each and every single framework and I really want you to enjoy that same joy. 🙂 This article is dedicated to open source community and cross-platform languages and compilers. I will demonstrate a few of the compilers, a few languages (the languages that you know of!) and a few operating systems to try out.

Introduction: Open source community and platforms

If you are a newbie to computer programming, then you may be asking yourself what is “open-source” and what is this term “cross-platform”. Hold your thought, in this section I will provide you with a good introduction as to what these two things are. Pretty much, it could have been done by forwarding you to Google, much rude! Or I could just try to give you a simple-English introduction of these two things.

Open source software is mostly research or helpful programs.

Open-source projects and communities

Ever since computers got introduced, yeah, back in the days of ENIAC, MANIAC and so on. Back in those days, computers were not as easily programmed as they are right now. Programmed? Even there were no “a lot of” programming languages. There were just a few, FORTRAN, Assembly language, COBOL and so on. In those days, Dennis Ritchie, the great programmer at AT&T, developed C programming language because every time a new mainframe was created. He had to re-write the software for it from ground-up. He invented C, implemented the first C program and indeed used Assembly language to compile the C programs. He did not keep it to himself, he created

  1. C language
  2. First compiler for C, at that time it was written in Assembly language
  3. Unix
  4. A concept that, “Everything is a process, unless it is a file“.

He did not keep them to himself. Instead, he shared the compiler, language, operating system. That is a separate story that AT&T claimed the proprietary rights later. But, Dennis did what he could.

This way, open source community started in computer universe. Open-source, as the name states, means a project or program or algorithm, whose “source code” has been provided “openly” to the public without having them to pay anything at all, but respect! Thus open source community means a community where programmers:

  1. Look forward for real-world problems and confusions.
  2. Find a logic for that problem.
  3. Develop a solution for that problem, in a way that they can.
  4. Implement the solution for themselves.
  5. Share the solution
    In its full form. Without claiming anything, and allowing anyone to use it.
  6. Community reviews and share their opinions (positive and negative) on the solution.
  7. Community can also make changes to the solution, to make it better.
  8. Then forward the updated version.

Not only just this way helps other programmers, but it also invites more advanced genius people to contribute their ideas too, forming a big great idea!

Collective thinking can result in a great idea!

I am highly convinced that every programmer who plays his part in open source community does earn something, respect. The most valuable factor in this universe. They are the unsung heroes.

Superheroes do not need to be praised! They just do the good stuff.

If you make up your mind to contribute toward open source communities, I would recommend that you do so. It doesn’t only share your views with the world but also makes it possible for others to fix your mistakes so that you know where to focus next time.

How to contribute?

Contributing to open-source community is very simple. Create a new project and just publish it. You can:

  1. Publish the project on one of the open source communities, such as GitHub.

But before you do that, please read the terms and licenses. Even open source projects need a license so that “you continue to earn the respect“.

Open source initiative.

Cross-platform support: Meaning?

That was the discussion for open source projects. Now let us discuss a few things about cross-platform support. But first, you need to understand what a platform itself is?

Did you know: Cross-platform is also a platform, supporting minor platforms. 

What is a platform?

A platform is a computer hardware and software combination on which a program runs. A platform is a combination of both hardware resources, such as

  1. CPU frequency
  2. RAM size
  3. HDD space
  4. GPU capacity
  5. Much more based on your program.

… And also the software platform being provided to install on, such as:

  1. Operating system
  2. Third-party or extended framework; .NET or JVM for example.

These collectively create a single platform. You develop an application that runs on a platform, for example if you create a C# application for .NET’s WPF or WinForms platform, application will only run on that framework; .NET framework. Similarly, the applications that you develop for Windows won’t run on Linux and the ones for Linux won’t run on OS X for Mac. That is why, keeping the platform in mind is one of the most important factor to be kept in mind while programming.

What is cross-platform support?

Cross-platform support means to support and run on multiple platforms. In a sense, it means that a code is able to run on multiple frameworks, platforms, operating systems and machine architectures.

A cross-platform programming language is the one that is able to run on multiple frameworks, operating systems and machine architectures. There are many factors that cause the language or tool to be able to run on multiple machines and platforms. Compiler, language used, statements and resource consumption is one of these things that you should consider while programming.

For example, C and C++ code is cross-platform because the compiler translates the code to Assembly language for the architecture of the machine being used. Same thing happens. I will demonstrate the use of C and C++ on multiple frameworks a bit later. For now, you should only understand what cross-platform support it.

Cross-platform also means to support devices of any size, from mobile to big screen computers.

Cross-screen development has been popular in web development.

Cross-platform support not only provides you with good experience on multiple platforms, operating systems or tools. It also provides you with a great set of audience. Cross-platform support “exponentially” increases the users for your application. Consider this, if you have an application that only runs on Windows. What if you can run the same application on Android, iOS, Xbox and so on and earn revenue from those platforms too?

That is why, it is always recommended to consider “cross-platform” standards also while developing an application. There are many great tools for cross-platform development. For example, you can build using:

  1. C# — C# can be used to develop for Windows, Linux and OS X using Mono.
  2. Java — Java is a very great language, high-level yes, and the bytecode can be executed by JVM wherever it can be installed.
  3. C or C++ — These languages just need your compiler to be translated and fine-tuned to support a platform. The languages are fully packed with excellent power and toolset to “make your computer do anything!

Ever wondered how does the following C++ program always work on every platform in a similar manner?

#include <iostream>

int main() {
    std::cout << "Hello world from C++.\n";
    return 0;

Compile it on Windows, it would work. Compile it on Linux it would work on Linux too. Why? I would recommend that you find answers to these problems before I actually write and complete my next article, which is about how programs are executed on different platforms and frameworks.

See you in the next post.

Downsides of learning {programming-language} in {x} days!

This might be my first post about such topics… Which might contradict other (self-claiming) authors who say that they can teach you a programming language in a number of days. For example, “Learn ASP.NET in 7 days”, “Learn HTML5 in a matter of 3 days”. Let me point out a few of the downsides of this type of teaching and learning for new developers, who might fall for this approach.

Who are the victims?

The most victims to this type of approach are the young developers… Inexperienced, rushing to learn new things, express-to-impress type of teens and those with a deadline of them self fall to this type of approach very often. Sometimes those who cram the rules, types, structures of the language do so.

Remembering never helps you out! You have to understand how things work.

Remembering never helps you out! You have to understand how things work.

Most usually, the teens who are eager to learn something in a very short number of time are victims to this approach. 7 days? 14 days? Seriously? What is it like… A pond’s challenge! Programming is something that cannot be fed into minds of other people; you cannot move a clock in simple harmonic motion and expect the human to become a programmer once you’re done hypnotizing and brain washing him. It cannot be taught the way we learnt it. It must be taught by lowering our standards to the standard that our student can understand us. Our students come to us to learn… We should educate them, not force them to remember what we said.

Who claims such thing?

I have no personal hatred towards those who claim such. In fact people who are extraordinary in learning and experimenting claim such things. They learn things in a very fast manner. Authors who write a title to their publication in a way, “Learn {subject} in {x} days!” are them self very quick learners. That is why they expect others to learn the same subject in a very fast manner.

It won’t be false to claim that they actually are very genius of their era. They have a very resilient grip of their subject and field. But not all fingers are of same size. Are they?

Discussing the downsides of this approach

Now let us discuss, why new programmers should not learn programming or any architecture or a framework using this approach. I would state a few points of mine, you can have your own feelings and opinions and might contradict to mine. But… Be logical and learn stuff slowly and by understanding what they are to you!

Not at all a true statement

First downside that I feel about such content is that they are not at all true. How can someone claim to teach you something in a matter of deadline. I teach programming to a few, some of them learn the concept very quickly. Some take time… Some take a lot of time. For those who take a lot of time, I try to make sure that they at least learn and understand the basic concept and tend to do something with it. I do not expect them to cram to reach the “x” days limit.

More appropriately such topics for publications are a term for publicity stunt. Because they are more straight-forward, targeted by those who want to make more in less time, author is challenging himself to be able to teach you more in less days.

Different psyche levels

Humans do not have similar psyche level… And you just cannot expect everyone to be similar when it comes to ability to learn and understand something. It would be responsibility of the instructor to teach his/her student in a way that they can surely learn something and not just waste their own time. I have taught people of almost every psyche level… From geniuses to average students. Those who were genius asked such questions which led me to go deep inside my mind to extract a scrap of information which I had locked in my limbo for a decade (not really!). Those who were average students had to pay some more time to learn it, they also tried not to understand the concept as to apply it. But just to learn it… To learn it!

I had never been a great instructor. So I have tried giving them a lesson in a way a friend would. Publications claiming to 5, 7 or 30 days time period don’t claim that they would teach programming to those with average mind set. They are of the same period and good use to someone who has the 100% same mental ability as the author had when he was learning the same framework or language.

A book, in any way cannot claim that the readers are expected to benefit from the content. But, claiming something that is not expected or guaranteed should not be used. When an author claims something, he must be able to prove it.

Only good side of this…

The only good side of this approach is that the subject is catchy! 😉

Personal views

There are many other points… But, I would not want to criticize such content any more. Instead I would share my views to beginners how can they benefit from less in more time.

Practice makes you better!

First of all, I should say that you need to practice what you learn. Practice is something that doesn’t make the applicable task easier, it just makes you better!

You should never think things are getting easier. It is you who have evolved.

You should never think things are getting easier. It is you who have evolved.

What Google might respond to your search as?


I learnt programming in a matter of 2 months. I just learnt C# at that time… Not software programming! There was nothing that I knew about creating an efficient software, writing a good API, creating a web application and so on. The more your practice the better you get. More errors you get, more you will understand. Sometimes when I go back in time 3 years ago and have a look at my questions, problems that I faced. I laugh. That doesn’t mean things are easy. That means practice has just given me enough understanding of these frameworks that now I can slice and dice them in any way that I want to. It also now has an impact on my social life.

Now, after learning and practicing. I speak less but qualitative. The quality of my speech is great now. I do not speak gibberish (or that I feel like).

Now, after learning and practicing. I speak less but qualitative. The quality of my speech is great now. I do not speak gibberish (or that I feel like).

There is no limit to study

I can build good applications in a matter of day or two. But that doesn’t mean I should give up learning more and more about such particular platform or subject. I have good grip over .NET framework, but I believe I should learn more and more.

Every new developer must only focus on learning part. I remember a lot of good threads where I have participated, ended up in a same conclusion. That you cannot learn anything in a matter of week, fortnight, month or even a year. You need at least to consume 5-10 years to learn something. Yes, if you’re going to cram through the concept for a term test then good, do it. It might even take 3 days for that.

Focus on something… Put smaller time periods in your learning

But to learn something fully, you need to focus on it in a very better way. Give more and more time to it. Let it settle down. Give your education a short time of more like 30 minutes, 45 minutes regularly. Try something, learn something. You would stumble upon more like a million errors before you can think yourself as a pro beginner! Before you can even enter intermediate level, you will fall into the errors like a million, or billion times.

Do not rush!

There is no need to rush. You can learn something in a very easy, smooth and friendly way. For new developers, it is a very good approach to read articles of other developers, read their code. Reading good content, good articles, good code helps you out to understand how they did. Remember they might be better than you (I don’t mean to tease anyone here, sorry if you take my words seriously), so if they did something in one day and you took 3 days. Do not hesitate! It is OK!

Finally. It is you, who knows where you lag. Best learning environment is when there is an instructor available for you. Books, articles, blogs do not teach you in a way they can. If you are a beginner never rely on them. If books were everything there would have been no requirement for a school, institution or university. There would have been great great libraries every where. You should ask your instructor what to do and how to do. Your instructor should help you out… He should be able to know where you lag behind others. He should polish you in a way that you can really get into something.

Scanning file for particular string or character (Searching)

Last fews days ago, I saw a post on Stack Overflow in which the user wanted to search the file content. Although I didn’t answer that post because it was off-topic for that website. But, now I wanted to share the code for that particular action to the public.

I was working on this project since today morning and I finally came up with the code for that. Actually not only me, some other Helpfull fellows from the Stack Overflow community too. I had a problem in my code but the guys there helped me and made me move on to my right track. A warm thank to them.

Well the code was simple and small in size. Although it was a powerfull code. I used a simple File.txt file in the res folder and then the coding began. Here is the file content.

Ok, here is some text!

Actually this file is created to test the validity of the java application

Java is my favourite programming language. I can say that, because for my every tag

on Stack Overflow, I have no enough score. But for Java I have scored enough!

And I think I can score even more 🙂

Wish me luck!

Then I wrote the code to search this file for the character or a string the user would input. Definitely I would search for a String, not a character. Because character would always be present in the file somewhere.

The code is


import java.util.Scanner;

public class Main {
   public static void main (String[] args) throws IOException {
   // Only write the output here!!!
   System.out.print("Write the character to be found in the File: ");
   Scanner sc = new Scanner(;
   String character =;
   // Find the character
   System.out.println("Searching now...");
   // Close the resource!
 // Get character and all other methods would be here...
 public static void getCharacterLocation (String character) throws IOException {
   System.out.println("File found...");
   File file = new File("res/File.txt");
   Scanner sc = new Scanner(file);
   int lineNumber = 0;
   int totalLines = 0;
   boolean found = false;
   // First get the total number of lines
   while(sc.hasNextLine()) {
   System.out.println("Line looping! For Total Lines variable.");
   int[] lineNumbers = new int[totalLines];
   int lineIndex = 0;
   System.out.println("Searching in each line...");
   sc = new Scanner(file);
   while(sc.hasNextLine()) {
     // Until the end
     /* Get each of the character, I mean string from
     * each of the line... */
     String characterInLine = sc.nextLine().toLowerCase();
     if(characterInLine.indexOf(character.toLowerCase()) != -1) {
       found = true;
     System.out.println("Searching complete, showing results...");
     // All done! Now post that.
     if(found) {
       // Something found! :D
       System.out.print("'" + character + "' was found in the file!");
     } else {
       // Nope didn't found a fuck!
       System.out.println("Sorry, '" + character + "' didn't match any character in file  .");

Share the code, and do remember to ask for more!