Some cool tricks in Java

Java☝:: A most beautiful and powerful programming language👌.
as much as you'll deep dive into Java you'll learn something new.
Here are some Amazing and cool trick's -
1-
Do you know what will be the output of the below statement? 👇
System.out.println(0123);
o/p = 83 but why?
Click on Below - 👇👇👇
2- Java String
Concatenation - concat() Vs the + Operator
concat() --
if want to concat str1 with str2 where str1 is null.
str1 = null;
str2 = "javaoneworld";

str1.concat(str2);

you'll get NullPointerException👎👎.
  • Operator --
  • if want to concat str1 with str2 where str1 is null.
    str1 = null;
    str2 = "javaoneworld";
    
    str1+str2;
    
    you'll not get NullPointerException instead you'll get some  output😅😀.
    
    o/p - nulljavaoneworld
    Follow the below beautiful url for some more cool tricks.
    How to execute commented code? and more.
    Thanks a bunch for being here.
    stayhealthy
    takeCare
    stayCode
    programming
    coder
    code
    happycoding

    23

    This website collects cookies to deliver better user experience

    Some cool tricks in Java