• Google+
  • Twitter
  • YouTube
  • RSS
  • Facebook

Latest Java and Programming Tutorials

C++Tutorial for Beginners 22 – Sizeof and Arrays

coffeenews
You can use sizeof to find out how many elements are in an array. All you need to do is divide the t……..

C++Tutorial for Beginners 21 – Multidimensional Arrays
C++ Tutorial for Beginners 20: Arrays – Your C++ Shopping Lists
C++ Tutorial for Beginners 19 – Take Control of Your Loops with Break and Continue
C++ Tutorial for Beginners 18 – “For” Loops: The Swiss Army Knife of Loops

You can now access ALL my premium courses for just $19 a month, cancellable anytime; no minimum period. Click here!

Coming soon: a particle fire explosion tutorial in C++!

Java Spring Framework Tutorial

The Java Spring Framework Tutorial

My latest premium tutorial is an extensive introduction to the popular Spring Framework, including web programming with Spring MVC. $29.
My Kindle book about online teaching and my many attempts to free myself from office work … How to Make a Great Living Teaching Online

Java for Complete Beginners

Java for Complete Beginners

Completely free if you sign up via this link. Over 175,000 people have already joined this course on Udemy.com! Now available right here too. This course teaches you how to program in Java from scratch.
You can find lots more courses here

Want a Course but Can’t Afford to Pay?

If you want access to one of my paid courses but can’t afford to pay, email me at john@caveofprogramming.com with a brief email explaining your situation, and I’ll consider giving you free access.

Donate

If you feel like sending me some cash … well, thanks! You can do so right here:

Get a Job as a Software Developer

If you’re looking to get a job in software, my free Java for Complete Beginners is all you need, at the minimum. If you master the contents of this course and you’re prepared to travel and apply for lots of stuff, while there are no guarantees, you’ve got a good shot at getting a job as a programmer. This course includes advice about getting a job.

If you want to improve your chances by learning an advanced Java specialisation, my Servlets and JSPs (and JSTL) course gives you very marketable skills. You’ll need to separately study HTML and CSS a bit (not as hard as Java!) and preferably some SQL too.

Alternatively, you could Learn Android Programming or try Mastering Java Swing; Swing is widely taught in universities, but there are less jobs around for it than for web-based stuff (see Jobserve).

Finally, The Java Spring Tutorial gives you some very hot skills, but it’s advisable to learn about Servlets and JSPs first, unless you like being dropped in at the deep end.

My other free courses, Java Multi-threading and Java Design Patterns and Architecture, will certainly improve your chances in a job interview, and you can take them in whatever order you like.

{ 550 comments }

Leave a Comment

  • Ralph Hosmer September 16, 2014, 7:07 pm

    John,
    FYI, don’t bother spending more of your time. I made the change you suggested, and it helped, but still got ’0 length’ on some sites. I ‘fiddled’ around some more and, at least. got different results. I’ll probably continue to ‘fiddle’, and here is the latest [FYI]:

    // Lecture 64: ‘Java for Beginners’ 16-Sept-2014
    // Output after deleting ‘www’ from URL name, per input from JOHN
    // Output with Buffered Reader and
    // ‘System.out.println(html.length());’
    // ‘//System.out.println(html);’
    //69451 [http://caveofprogramming.com]
    //0 [http://facebook.com/caveofprogramming] * (1)
    //156814 [http://news.bbc.co.uk]
    //0 [http://mail.yahoo.com] * (2)
    //269032 [http://theblaze.com]
    // * (1) Guess: have to be signed into Facebook first?
    // ………. It did not help to sign into Facebook first
    // …. Change URL to”http://facebook.com” and sign into Facebook first:
    // ………. It did not help
    //0 [http://facebook.com]
    // * (2) Giess” Change to “http://yahoo.com”? Now WORKS
    //1450 [http://yahoo.com]

    // Output after above changes:
    //69451 [http://caveofprogramming.com]
    //0 [http://facebook.com]
    //156165 [http://news.bbc.co.uk]
    //1450 [http://news.bbc.co.uk]

    Thanks again,
    Ralph

    Reply
    • John September 16, 2014, 7:23 pm

      It’s no problem! Sites that require a log in, you’ll have problems with. Java is in effect a separate browser to whatever other browser you’re using, so logging in in a browser won’t help. It is possible to log in to a site with Java, but require further code. Some sites may not display unless cookies are enabled, which again require some extra code (but not much).

      Reply
      • Ralph Hosmer September 16, 2014, 9:02 pm

        John,
        Thanks for all the help, and for a really interesting and educational course.
        Ralph
        ps: I’m also in the middle of a 4-course series on AstroPhysics @ edx.org from the Australian National University [anuASTRO1x, 2x, 3x and 4x]. It’s not in my educational field [BSEE MichiganTechnologicalUniversity: 1961], but I find it vary interesting and recommend you try it [Free to audit] if you want to go ‘outside your box’.
        Thanks again,
        Ralph

        Reply
        • John September 16, 2014, 9:16 pm

          Cheers Ralph. I studied theoretical physics, so it might be a bit in my box. But then I did almost fail altogether, so could be somewhat outside my box also …

          Reply
  • Ralph Hosmer September 15, 2014, 4:38 pm

    John,
    I’m taking ‘Java for Beginners’ and have completed thru Lecture 64: Implementing Iterable. I’ve got working code, but the HTML Length Outputs:
    62887
    0
    java.net.ConnectionException: Connection refused: connect
    0
    …. the rest of the Stack ..

    My guess is that I’m in the USA and these sites are whereever was handy for you. .. Timeout: waiting for connect
    SUGGESTION: If the Lecture is ever edited: Add some kind of comment [written or verbal] about this possibility, and if your enthusiasm holds up, show us a way around the problem.
    When I changed the UrlLibrary to USA sites, I still sometimes get a 0 length, but I don’t get the ConnectException thrown.
    Thanks for a very informative course,
    Ralph

    Reply
    • John September 15, 2014, 9:07 pm

      Hi Ralph, this really shouldn’t happen — I wonder if you are using a proxy or have some intermittent Internet problem? If a browser can access websites, so should Java be able to … I wrote this code in Hungary, so not in the UK … I would find it extremely strange if Java cannot connect to UK sites from the US. Using this code, I can download from any site in the world that I’ve tried so far — cnn.com, for example.

      Reply
      • Ralph Hosmer September 16, 2014, 12:01 pm

        Hi John,
        I’m a ‘user’ of the internet. My ISP is Time-Warner and I use their cable modem and my Belkin router {just for added firewall protection} connected to my HP 500-314 computer (purchased this year). Beyond that, I’ve not yet attempted to build a web-site, and my internet usage is browsing, Yahoo Email, on-line banking, taking courses {ie: Java for Beginners} and watching online Programs (ie: http://video.theblaze.com}. I don’t know about the inner working of the internet, and I wouldn’t know a ‘proxy’ if I saw one. My question was more of a curiosity question (why length = 0 when I use the sample program in this course trying to access different URLs). If I ever do attempt to build a web-site (which is not totally out of the question) I’ll have to educate myself. Any insights you can provide would be appreciated.
        Ralph

        Reply
        • John September 16, 2014, 12:20 pm

          I’m clueless, Ralph … there’s no reason here that I can see, why it wouldn’t work. If you want to paste me your exact code, the one that doesn’t work, I can see if I can run it or if there’s some sort of problem that’s crept in …

          Reply
  • Abhi September 14, 2014, 5:17 am

    Hi,John I have gone through your free videos which has helped to become a good programmer but John I need some of paid courses I can’t afford to pay the prices because don’t have credit card and here to credit card is one of the toughest job.
    So pls have a look to my request.
    Thank you

    Reply
  • Ralph Hosmer September 12, 2014, 3:27 pm

    [copied from Udemy' [posted 6 days ago]

    Lecture Comments

    I have some programming background (Basic, Visual Basic in msOffice, several AI languages: All mostly for personal gradification ).

    I’m thru Lecture 51 with working Eclipse programs and the Eclipse programs and output copy/pasted to an Excel Worksheet (for future off-line reference). As I’ve gone thru each Lecture, I’ve added COMMENTS to each program which hopefully represents the jist of your verbal lectures. QUESTION: Is there a TRANSCRIPT of your Lectures available ? Thank you for an excellent intro to JAVA. ps: The “screen capture” approach to the videos seems to result in slightly blury results – Still legible, but with some difficulity.

    Reply
    • John September 12, 2014, 3:30 pm

      Hello Ralph, there is no transcript, but on Udemy I believe it’s possible to switch on captions, which seem to be excellent. Be sure to switch on HD too — otherwise the video will definitely be blurry. There should be a HD button somewhere around the lower right when the video plays.

      Reply
      • Ralph Hosmer September 12, 2014, 4:37 pm

        Thank you John,
        I kept cleaning my glasses, but it didn’t help my 75 year old eyes.
        Ralph

        Reply
        • John September 12, 2014, 6:29 pm

          It should be fairly sharp with HD! Similar to a computer screen. My Eclipse default font is quite small though. I recently worked out how to change it … Good to have a reminder!

          Reply
  • ibrahim September 8, 2014, 11:45 am

    your work is amazing :)
    i got ? that in your GUI course at Lesson 7 Communication Between Components you have change sysout by TextPanel.append(“..”);
    it show me error underlined in TextPanel that i cant append?

    Reply
    • John September 11, 2014, 9:41 am

      Thanks! You need to use the object you created with “new”, not the class. E.g. myTextPanel.append() rather than TextPanel.append()

      Reply
      • John September 11, 2014, 9:42 am

        I’ve just realised, you may have called your text panel object “TextPanel”. This isn’t a good idea — it should start with a lower-case letter; there may already be a class called TextPanel, which is causing the confusion.

        Reply
  • Steve Kohler September 7, 2014, 4:06 pm

    I have been programming a long time, but somehow just procrastinated on Java. Thanks for putting your great course online and letting those of us who have let our skills lapse get caught back up without spending my family’s rent money! Keep it up. I am sure I will in fact be buying your more advanced courses.

    Steve Kohler

    Reply
  • Edward August 31, 2014, 3:39 am

    Hi John,

    I bought all of your courses on Udemy (Spring, Servlets, Swing, Android and Perl). Do I need to purchase the courses again on your site?

    P.S. Your courses are awesome. It helped me understand the Object-Oriented and Design Pattern concepts using Java Programming Language.

    Reply
    • John August 31, 2014, 8:29 am

      Thanks a lot Edward! If you register free on my site and let me know the email address you registered with, I’ll subscribe you to everything.

      Reply
  • Keith August 29, 2014, 4:37 pm

    Hi there.

    Done with Java for Beginners and will probably do Collections and Threads next

    I googled for some sample java exercises with worked solutions and found a couple of decent sites, wondering if you have so e favourites you would recommend so I can practise the stuff you taught in Java for Beginners?

    Besides Collections, Threads and perhaps Design patterns, what else would you recommend?

    Reply
    • John August 29, 2014, 9:34 pm

      Hi Keith, I don’t ever do exercises myself — only Googling for tutorials. But someone mentioned http://codingbat.com/ . Collections are really important to know about, so I can recommend that! You need at least the first few videos’ content to be able to do any real Java programming. After that you’re pretty much set to tackle whatever you want. Threads are vital for some programs, but not used at all in many.

      Reply
  • Muhammad August 29, 2014, 11:23 am

    Hey John,
    I’m trying to create a chat application for android, I’m now trying to connect my app to mysql workbench database (for test). I’ve followed this tutorial
    http://programmerguru.com/android-tutorial/how-to-call-java-web-service-in-android/
    Note : i tried to access localhost from android emulator using 10.0.2.2:8080 and my pc’s ip:8080 and localhost:8080 but i get HTTP Status 404, The requested resource is not available..
    Thanks :)

    Reply
    • John August 29, 2014, 11:35 am

      I’m only familiar with JSON, so probably can’t help … I should think you can’t connect directly to your database in Android, only through a web service or JSON or something similar.

      Reply
  • ahmed August 28, 2014, 8:05 pm

    when I open offres-servlet.xml
    i can’t see mvc button
    note: i have jar spring web-mvc download to the project

    Reply
    • John August 28, 2014, 9:15 pm

      MVC button?

      Reply
      • ahmed August 29, 2014, 3:32 pm

        hi John,
        i have eclipse
        Version: Luna Release (4.4.0)
        Build id: 20140612-0600
        on dependendcies tab i see mvc jar 1.6 and less.. but on your tutorial i see mvc jar 3.2.3 release .. how i get the latest jars

        Reply
        • John August 29, 2014, 9:38 pm

          Are you looking at my Spring tutorial, Ahmed? If so, make sure your Maven repository is up to date (there is a FAQ showing how to update it attached to one of the final lectures, if you scrolled down the course list — titled “FAQ”), but most likely you are looking at the wrong dependency group ID. Make sure you go to the right bunch of Spring dependencies — the org.springframework ones if I remember rightly.

          Reply
  • Ansul August 19, 2014, 11:37 am

    Hi John,

    I am really enjoying your beginner Java tutorial. I wanted to know, is there a website or something from where I can get programs/questions/problems to practice, to enhance my skills.

    Thanks
    Ansul

    Reply
  • Baris Bozkurt August 18, 2014, 8:56 am

    Dear John,
    I have been watching your Java for beginners lectures for the last few days. I have already completed a few other similar online courses to compare teaching styles. Congratulations and thanks a lot for producing these great teaching materials and making them available. They are very clear, well-organised, and they present the core material in a very easy to understand style. They will for sure be inspirational to many people teaching similar content. My best regards.

    Reply
  • Ki August 13, 2014, 2:08 pm

    Hi John, i am from China. Thanks for your efforts. I am following your Java beginners tutorial now. It makes points clear and simple.

    And I am wondering which fonts are you using in your eclipse because I can’t find it.

    Reply
    • John August 13, 2014, 10:06 pm

      Hi Ki, I don’t know … can you post the code you are using? I don’t use any special font, just the default.

      Reply
      • Ki August 14, 2014, 2:09 am

        Hi sir, I’m afraid the code will transform to default font when I post here. Never mind. My current font is OK.

        Thanks anyway. have a nice day.

        Reply
  • Evert Dhont August 13, 2014, 6:03 am

    Hi there John!
    First of all, I like your work very much! Right now I am learning your Java for complete beginners course, and there I was playing with the code of the getting user input video and I wondered why if I enter some text in the program with a capital letter in it, the program just displays the first letter? I really don’t know what the problem is but it’s a kind of frustrating so I hope you can help me out!
    Thanks in advance,
    Evert

    Reply
    • John August 14, 2014, 11:57 am

      Post your code, Evert!

      Reply
      • Evert August 14, 2014, 12:35 pm

        Thanks for help but it seems like I fixed the problem on my own… I think it had something to do with the version of Java I was using because I was programming on my android device… Now that I have my computer back, the problem isn’t there any more…

        Reply
  • Arpan Sharma August 12, 2014, 2:38 pm

    Sir I have watched your free courses and i want to enroll for jsp & servlets but I don’t have any credit card.
    So what to do???

    Reply
  • Justin Willingham August 8, 2014, 10:33 pm

    Thank you for doing this John. I completed your Java for Beginners course and I’m about half way through your Java Multi – threading course. Now preparing for my Oracle Associate Certification!!
    Thanks to your course… It’s really appreciated.

    Reply
  • berker August 8, 2014, 7:06 pm

    hello John,

    i have been following your Java for Beginners tutorials from udemy.com for a couple of days now. They are quite good actually but i want to make a little suggestion.
    i searched google for Java exercises, both to practice and understand how different methods are used and found this http://www.ntu.edu.sg/home/ehchua/programming/java/J2a_BasicsExercises.html

    it was great to practice what i learned from your lessons, so i understand everything better but those exercises and your lessons does not sync. so it would be great if you can also supply some exercises with solutions for each lesson or maybe exercises for a group of lessons.

    by the way, i really appreciate what you have been doing here.

    Regards
    berker

    Reply
  • Muhammad August 6, 2014, 9:33 pm

    Hey John,
    I’m trying to connect my swing app to an online database as i can edit the database from other computers.. I need a website that host my database for free (as it’s a small app for test) and if I find that site how can I write the connect method ? I mean Class.forName(“what will be here ?”).newInstance();
    String connectionUrl = “and here ?”;
    Thanks. :)

    Reply
    • John August 7, 2014, 12:52 pm

      The class.forName bit would be the same as if it’s on your local machine. The connection URL would depend on the URL where you’re connecting to your database. Your host will hopefully give you that information! Something like jdbc:mysql://localhost:3306/dbname, but localhost:3306 will be replaced by the URL or IP address and port number of your database, and dbname with the name of the database you create.

      Reply
  • Onur August 6, 2014, 7:32 am

    Just wanted to thank you for your effort. I wonder if there is any way to follow the tutorial “offline” like a movie or something?

    Thanks!

    Reply
    • John August 6, 2014, 4:25 pm

      Hello Onur, it should be possible to download my videos one-by-one. If there are any you want to download and can’t, let me know, because maybe I just need to switch them to downloadable by hand. You can also find my courses on Udemy.com, where they should also all be downloadable.

      Reply
  • vicky August 5, 2014, 6:38 am

    Hi, John

    I wanted JDBC tutorial from you. I dont know it’s already there or not please help me out.

    Reply
    • John August 5, 2014, 11:34 am

      Hi Vicky, I include some basic JDBC stuff in several of my tutorials; especially the Swing one. But I don’t have a specific tutorial on it.

      Reply
  • Emre Yavuz August 3, 2014, 12:03 pm

    Hello, I have learned a lot of your java turtorials but i got a question.

    Can you please make a turtorial about javaFX?

    I have heard Oracle is gonna focus more on javaFX than Swing

    I hope you do it :)

    with kind regards, Emre

    Reply
    • John August 6, 2014, 4:58 pm

      I’ve made a few, so far … have a look at the video section …

      Reply
  • speed August 2, 2014, 1:27 am

    hello john

    i want a subtitles for ur videos plz

    Java Swing (GUI) Programming: From Beginner to Expert

    thx

    Reply
  • James McGiveran August 1, 2014, 5:35 am

    Hi John,

    I just wanted to thank you for all of your hard work. I am working my way through the Java for Complete Beginners and I find you to be one of the finest instructors, in any discipline, that I have ever encountered. Your explanations are clear and to the point. The shorter video format allows me to go back and forth and fiddle with the code. I am truly appreciative. Can you please recommend which course I should take next after this one? Are your courses set up beginner / intermediate / advanced or are they more subject based? Thanks again John, Jimmy

    Reply
    • John August 1, 2014, 8:39 pm

      Thanks James! You can try any other of my courses after the beginners’ Java one really. Except it’s probably easier to tackle Servlets and JSPs before you do the Spring course.

      Reply
  • sujay July 31, 2014, 8:20 pm

    Hi,
    John ,I am Sujay from India I have watched your tutorial for Java for complete beginners,this tutorials helped me lot in my exam.I wanted to buy your tutorials for java swing but now they are showing me 39$ ,which i can’t afford can you please tell me how to avail the discount for someone from india so that i can buy them for my next exam!
    Thanks in advance :)

    Reply
  • Miguel Rios July 31, 2014, 6:17 pm

    Hi John! Thank you very much for your work!

    Reply
  • Joseph July 31, 2014, 4:53 am

    Hello John.

    Just wanted to leave a comment to show gratitude. I am working my way through your java for beginners series and out of all the other tutorials that I have looked at I find yours to explain everything in a way that someone new to programming can understand. I plane to look at your other tutorials (focusing on java for now) and when the time comes I will have no problem purchasing the additional content. Please keep it up.

    Thank you
    Joseph

    Reply
  • Kushal July 25, 2014, 2:33 pm

    Hi John,
    I love your work and appreciate your effort.
    Keep up the good work

    Reply