Coding Startup

Sometimes you need advice, Ask a teacher to solve your problems.

Sometimes you need advice, Ask a teacher to solve your problems.

Make a Difference with education, and be the best.

Make a Difference with education, and be the best.

Putting Children First. Preparing Children For Success In Life

Putting Children First. Preparing Children For Success In Life

How you can get top grades, to get a best job.

How you can get top grades, to get a best job.

Latest Posts

Simple Java Program | Some Facts That Nobody Told You - CodingStartup

Code Startup


In This Topic:

In this topic, we will be covering some basic and advance details about Simple Java Program, Some Facts That Nobody Told You. Moreover , we will be covering the vision of looking to a programming language. As a result, you will also increase you knowledge about that java programming language.

Simple Java Program article is also helpful in interview purpose. The points which I am considering that will make you understand that how to understand a programming language. If you are new this site and wanted to learn full java then you must watch this Java Programing Course

Java code explained line by line

To explain this code, I will be considering for-instance of program. Firstly, we will have look on a basic java program structure. Last but not the least, we will we discussing about the some points in that simple java program structure. So lets have for-instance of a code and then we will discussing some points.

class CodingStartUp
{
   public static void main (String args[])
    {
    }
}

Now, in the above code, we have just written a simple code in which we define class, method, data types , array and some keywords which are pre-define in java. Now Lets talk about one by one.

What is Class in java ?

Class is user defined map or blueprint that in which objects are created. In other words, class is place where we can create or set some properties of some group by creating objects. Objects are nothing that have some properties like place ,thing or a name of person.

In the above, code we define class like this

class CodingStartUp

Here class is keyword and after that space, the class name which user has to decide.Before deciding name, there are some condition while selecting the name of program or name of class. Firstly, the first letter should be capital always if there is a single word. Secondly, If there are two or more words you cannot give space but you can use underscore like this Coding_start_up and if you don't want to use underscore then you can follow this standard CodingStartUp. Thirdly,and most importantly, you can not use space in any case while selecting the name.

What is public static void main (String args[]) in java ?

what is public static void main in java

 After considering the first line of code , now we will be considering second line. In second line, we got public static void main (String args[]) what it means, why we use it.

First one is public, it is a pre-defined keyword and access specifier. Access specifier is an term which we use to define access range of class and method. Now the Question arises that How many access specifier are in java? There are total Four access specifier i.e Default, Public, Private and Protected. Now here only, we will be talking about Public access specifier. Public access specifier define by its name only that everyone can you and from everywhere like public transport. Now, we will discuss it why main method is public in java?

why main method is public in java?

We use public access specifier only because main method is an entry point for running a program in JVM. To access the program details which we have written should accessible to JVM so that we use public with main. Now we will talk about Static.

What is Static modifier and use in java code ?

As the Question tells that Static is modifier and pre-define keyword. It is assign for the management of the object memory. In other words, Static is used for object memory management. Now, The question arises that What is the use of it? Static means that on creation of an object. This means that when we create a method in java we have to create its instance (object). While using main method we also have to create object in java for using it. If we create, then ambiguity we be create. So to avoid that we use static modifier that will run code without creating an object.

What is void in java ?

Void is a data type which give no return value. We are using void with main method because this method does not give any return value. Now, That is the reason we use void with main method.

What is String []args in java ?

Now, Here String []args is parameter for the main function. This parameter comes with two section words i.e String and [] args. String is data type and also a pre-define class in java. [] args is an array with the name called args. We can use other names which we want to but we should use [] these brackets because it define array. We can also use these bracket after name declaration like this String codingstartup[]. String []args is used in main method for passing command line args while running a program. Now One question came to our mind that Why we use String data type in main method in java?

Why we use String data type in main method in java?

As we Know that Java is comes from C and C++. In C and C++, We can declare int in main method and it accepts that. The reason behind this is that C and C++ are both directly connected OS. While passing int parameter it will return value to OS. That are only two value i.e exit code and exit status. These values help to tell that program have successfully ended or error terminated. After getting these codes, OS will cleans up the process that is allocated to task. When exit code return 0 that means code has been successfully run without ant error. On another hand, non zero status tells about the error or problem.

In Java, we know that JVM runs the code in main thread and no direct interaction between OS and our code. Moreover, There is no direct link in resource and memory allocation between program and OS. JVM is directly connected to the hardware. Then JVM complete the work of main method by sending status of exit code and exit status with the help of one lib i.e java.lang.Runtime.exit. Moreover, if you want full explanation you can visit this site Why we use String data type in main method in java?

Conclusion

On the ending note, I would like to say that java language is a puzzle. More you you solving it , more you getting about it. This from my side. I hope you like to read my article and you get alot of knowledge from this article.

Some Important Rules To Start A Project Of Android Studio In 2020.

Code Startup

Some Important Rules To Start A Project Of Android Studio In 2020.

In This Topic:

In This Topic, We will be discussing about the trend of App Development in 2020. How much app development is important for an IT person and we will also see some numbers or percentages. Last but not the least, we will be discussing Some Important Rules To Start A Project Of Android Studio that will help while uploading on Playstore.

Trends:

As we know that, Technology is getting vast and our smart phones are getting smarter and smarter day by day. All customer need everything in one hand so app is only solution to this.because in our smart phones we use apps only whether it is gaming app, social media app, banking app,shopping app, traveling app or some business apps.
  
     Now if we talk about the percentage of user which spend on the apps i.e more than 60% and rest are on other things. Mostly those people spend more time on apps who doesn't have laptops or who does not need laptop for there work. If we talk about the social media apps that are mostly run or accessed by apps only by  the user.
    
    If you are from IT or you are planning to come in IT field, you should definitely go for app development. Before you start with android you must know about the basic one programming language i.e Java because you need to now about the java programming language and if you want to learn java I have some articles on java programming language from basic you can learn that also from here Java Programming




Steps To Create a project in android studio:

Step 1:-

              Open Android Studio
                To Open Android Studio , click on search at left bottom of screen and type android studio.
                double click on that first option.
Note:- Make sure that you should have good internet connection while using android studio because it require internet while working.
Some Important Rules To Start A Project Of Android Studio In 2020.

Step 2:-

                This type layout will be shown on the screen. Now click on first option from the screen i.e Start a new Android Studio Project.

Some Important Rules To Start A Project Of Android Studio In 2020.

Step 3:-

       After clicking that, a new type of layout will  be shown and then we have select a type activity we want in application. Now you have select Empty Activity  and click on Next button.

       Now let me tell you about the activity in app. An activity is the combination of two parts i.e Java and XML. Java is used for controlling part and XML is used for design or we can say that it used to provide interface of application.

Some Important Rules To Start A Project Of Android Studio In 2020.

Step 4: 

           After selecting the type of activity , then you we get the Configure Your Project page . In this page, you have set the name of project and application name in one field i.e Name. Then you have set the package name of your application.
    Let me tell you that you are setting up an important field which will help when you try to upload an app on Playstore. There are some set of rules while setting up package name.

  1. Com. :- Com is used for the commercial applications. While uploading the application you have to upload the some certificate or proof that you are an official company. For example: com.example.myapplication
  2. Info. :- Info is used for apps which provide some information to user and for this you doesn't require any proof or License. For example: info.codingstartup.abheer
  3. Edu. :- Edu is used for educational apps. For example: edu.codingstartup.abheer
  4. Mil. :- Mil is used for military purpose apps. For example: mil.indian.army
 And so on but you can also use any thing instead of this but your app will not uploaded. And one more trick while setting up package name you should check that your package is unique or not. your package name must be unique.To check you have just type your package name on playstore search bar if no apps comes then you package name is unique.

After that you have select language in which you want to work. Last but not the least, Minimum SDK is that minimum android version in which you app will run. For example we select Android 4.4 now from this version to latest version of android the will run. Lower version will not be supported.

After filling details click on Next button.

Some Important Rules To Start A Project Of Android Studio In 2020.

Step 5:-

            Now you have wait for something your project is building. It will also use internet to build gradle.

Some Important Rules To Start A Project Of Android Studio In 2020.

Step 6:

                After building gradle , you project will look like this.

Some Important Rules To Start A Project Of Android Studio In 2020.

I hope you get all the Important Rules To Start A Project Of Android Studio In 2020. If you like this content plz subscribe this website and share with your friends and also subscribe my YouTube channel for more updates.

Pascal's Triangle in java

Code Startup

Pascal's Triangle in java.


100% Working Code and Projects.


if you need any help about project and Application Contact Shelly at:+917888361589.



Java Code Given Below:-



public class Pattern {

    public static void main(String[] Abheer) {
        int  abheer = 1;

        for(int i = 0; i <7; i++) {
            for(int space = 1; space < 7 - i; ++space) {
                System.out.print("  ");
            }

            for(int j = 0; j <= i; j++) {
                if (j == 0 || i == 0)
{
                    abheer = 1;
 }               else{
                    abheer = abheer * (i - j + 1) / j;
}
                System.out.printf("%4d", abheer);
            }

            System.out.println();
        }
    }
}

Output:-

               1
             1   1
           1   2   1
         1   3   3   1
       1   4   6   4   1
     1   5  10  10   5   1
   1   6  15  20  15   6   1


Floyd's Triangle in java

Code Startup

Floyd's Triangle in java


100% Working Code and Projects.


if you need any help about project and Application Contact Shelly at:+917888361589.



Java Code Given Below:-

public class Pattern {

    public static void main(String[] Abheer) {
        int  number = 1;

        for(int i = 1; i <= 5; i++) {

            for(int j = 1; j <= i; j++) {
                System.out.print(number + " ");
                ++number;
            }

            System.out.println();
        }
    }
}


Output :-
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

Full Pyramid using @ in java

Code Startup

Full Pyramid using @ in java.

100% Working Code and Projects.


if you need any help about project and Application Contact Shelly at:+917888361589.



Java Code Given Below:-

public class Pattern {

    public static void main(String[] Abheer) {
        int  k = 0;

        for(int i = 1; i <=5; ++i,k=0) {
            for(int space = 1; space <= 5 - i; ++space) {
                System.out.print("  ");
            }

            while(k != 2 * i - 1) {
                System.out.print("@ ");
                ++k;
            }

            System.out.println();
        }
    }
}




Output :-
                 @
             @ @ @
        @ @ @ @ @
    @ @ @ @ @ @ @
@ @ @ @ @ @ @ @ @


Inverted Half Pyramid using @

Code Startup

Inverted Half Pyramid using @

100% Working Code and Projects.


if you need any help about project and Application Contact Shelly at:+917888361589.



Java Code Given Below:-

public class Pattern {

    public static void main(String[] Abheer) {
    

        for(int i =5; i >= 1; --i) {
            for(int j = 1; j <= i; ++j) {
                System.out.print("@ ");
            }
            System.out.println();
        }
    }
}

Output:-

@ @ @ @ @
@ @ @ @
@ @ @
@ @
@

Explanation :-

 First,Two Loop we are using for rows and second loop is for column . Second, we are using first loop in reverse to invert the pattern.

Half Pyramid using numbers in java

Code Startup

Half Pyramid using numbers in java

100% Working Code and Projects.


if you need any help about project and Application Contact Shelly at:+917888361589.



Java Code Given Below:-


public class Pattern 
{
    public static void main(String[] args) 
{        
        for(int i = 1; i <=5; ++i) 
{
            for(int j = 1; j <= i; ++j) 
{
                System.out.print(i + " ");
            }
            System.out.println();
        }
    }
}


Output:-

1
2 2
3 3 3
4 4 4 4
5 5 5 5 5


Explanation :-

In First Loop we are using for rows and second loop is for column . Second, We have use the value of i variable for printing the number



Developer

AbhinavB.Tech / Computers