• Skip to main content
  • Skip to primary sidebar

Founder at work

Master the skills to create and launch your next SaaS company

  • About Me
  • Reviews
  • Resources
  • Community
  • Contact
  • Lessons
  • Series
  • Search
  • Login

Wrapper class that prints integral types (byte, short, int and long) in columns.

August 17, 2013 by Rick Hernandez Leave a Comment

package Wrapper;

public class wrapper 
{

    public static void main(String []args)
    {
        System.out.printf("%10s: %,-30d %,-30d%n ",  "Byte ", Byte.MIN_VALUE, Byte.MAX_VALUE);
        System.out.printf("%10s: %,-30d %,-30d%n ",  "Short ", Short.MIN_VALUE, Short.MAX_VALUE);
        System.out.printf("%10s: %,-30d %,-30d%n ",  "Integer ", Integer.MIN_VALUE, Integer.MAX_VALUE);
        System.out.printf("%10s: %,-30d %,-30d%n ",  "Long ", Long.MIN_VALUE, Long.MAX_VALUE);
        
        char a = 'a';
        char A = 'A';
        char p = '#';
        char six = '6';
    
        System.out.println();
        System.out.println();
        
        System.out.printf("a: %s%n", letterEval(a));
        System.out.printf("A: %s%n", letterEval(A));
        System.out.printf("#: %s%n", letterEval(p));
        System.out.printf("6: %s%n", letterEval(six));

    }

    private static String letterEval(char ch)
    {
        String giveBack = "";
        
        if(Character.isLetter(ch) && Character.isLowerCase(ch))
        {
            giveBack = "Leter";
        }
        else if(Character.isLetter(ch) && Character.isUpperCase(ch))
        {
            giveBack = "Letter UpperCase";
        }
        else if(Character.isDigit(ch))
        {
            giveBack = "Number";
        }
        
        return giveBack;
    }
}
Rick Hernandez

I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related

Filed Under: Java, Programming

Primary Sidebar

Learn How To Take Your Idea And Convert It Into An App From Scratch Even If You Have Never Written A Single Line Of Code.

  • How to Find Your Next Great App Idea
  • The Secret To Getting PAID To Build Your Own App
  • How To Create Your App (SaaS, Mobile, VR, AR, Game)
  • How To Monetize Your Apps
Learn More
4.82 Ratings

Copyright © 2025 · JSecademy Blog Theme on Genesis Framework · WordPress · Log in