You are reading the article **How To Use Excel Countif Function (Examples + Video)** updated in March 2024 on the website Moimoishop.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. *Suggested April 2024 How To Use Excel Countif Function (Examples + Video)*

Simple calculation such as adding the values in a range of cells or counting the values in reach of cells is something that you would have to do when working with data in Excel.

And in some cases, you may have to count only those cells that meet a specific criterion.

And you can easily do that with the COUNTIF function in Excel

In this tutorial, I will show you how the Excel COUNTIF function works with simple examples add a detailed explanation

Let’s first look at the syntax of the COUNTIF function:

=COUNTIF(range, criteria)where

range is the range of cells where you want to count cells that meet the condition

criteria is the condition that must be evaluated against the range of cells for a cell to be counted.

Now let’s have a look at some examples that will show you how to use the COUNTIF function in Excel.

With the COUNTIF function, you can count all the cells that contain a specific text string.

Suppose you have a dataset as shown below and you want to count all the cells that have the text Printer in it.

Here is the formula that will do this:

=COUNTIF(A2:A9,"Printer")The above formula uses the text I specified as the second argument as the criteria and counts all the cells that have the same text (which is “Printer”)

In this example, I have manually entered the criteria text, but you can also refer to a cell that contains the criteria text.

Note: Criteria text in the COUNTIF formula is not case sensitive. So I can also use ‘printer’ or ‘PRINTER’, as the result would still be the same

Just like I used the COUNTIF function with text, I can also use it with cells containing numbers.

Suppose I have a dataset as shown below and I want to count all the cells where the number in column B is greater than 30.

Below is the formula that will do this:

The above formula uses the greater than an operator with the number as the criteria. This tells Excel to only consider those cells where the value is more than 30.

While there is the COUNTA function that counts the cells that contain numbers, there is no in-built formula that can count only those cells that contain a text string.

But it can easily be done using the COUNTIF function.

Suppose you have a dataset as shown below and you only want to count the number of cells that are text (and ignore the numbers).

Here is the formula that will do this:

=COUNTIF(A2:A10,"*")The above formula uses an asterisk (which is a wildcard character). An asterisk represents the text of any length.

So this criteria would count all the cells where there is any text string (of any length). In case the cells are empty/blank or have numbers in them, then those would not be counted.

Criteria could be a number, expression, cell reference, text, or a formula.

Criteria which are text or mathematical/logical symbols (such as =,+,-,/,*) should be in double-quotes.

Wildcard characters can be used in criteria.

There are three wildcard characters in Excel – the question mark (?), an asterisk (*), and tilde (~)

A question mark (?) matches any single character

An asterisk matches (*) any sequence of characters.

If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

Criteria are case-insensitive (“Hello” and “hello” are treated as the same).

Related Excel Functions:

You're reading __How To Use Excel Countif Function (Examples + Video)__

## How To Use Excel Vba Round Function?

Excel VBA Round Function

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

If the number you are trying to round have the last digit after decimal <= 0.4, it rounds it down (Round Down). Suppose the decimal part is exactly 0.5 then what does it do? In such cases, it checks with the integer part of the number. If the integer part is even then it rounds down to the even number of the decimal part. If integer part is odd, then it rounds it up to the even number. This method of rounding is also called as “Banker’s rounding”.

Syntax of Round Function in Excel VBAVBA Round function has the following syntax:

Where,

Expression – The floating number you wanted to round.

Decimal_places – It’s an optional argument which takes an integer value which specifies the decimal places up-to which the number is supposed to be round. Should always be greater than or equals to zero. If not specified, by default zero is considered. Which means a number is rounded to an integer.

How to Use Excel VBA Round Function?We will learn how to use a VBA Round function with few examples in Excel.

You can download this VBA Round Excel Template here – VBA Round Excel Template

Example #1 – VBA Round Function to Round a NumberFollow the below steps to use Round function in Excel VBA.

Step 1: Insert a new module under Visual Basic Editor (VBE).

Code:

Sub

Round_Ex1()End Sub

Step 3: Use MsgBox function to be able to pop up a message like this “The Value Rounded is:”

Code:

Sub

Round_Ex1() MsgBox "The Value Rounded is: "End Sub

Step 4: Now, add “& Round (10.9834, 2)” in front of MsgBox command, so that the rounded value will be shown up in the message box along.

Code:

Sub

Round_Ex1() MsgBox "The Value Rounded is: " & Round(10.9834, 2)End Sub

Step 5: Hit F5 or the Run button placed at the uppermost panel to run this code. You will see an output as shown in the below.

Step 1: Define a new sub-procedure in VBE to store a macro.

Code:

Sub

Round_Ex2()End Sub

Step 2: Define a variable named roundNumber as Double which can hold the value of the number to be rounded.

Code:

Sub

Round_Ex2()Dim

roundNumberAs Double

End Sub

Step 3: Assign a number value which is to be rounded to this variable using assignment operator.

Code:

Sub

Round_Ex2()Dim

roundNumberAs Double

roundNumber = 23.98End Sub

Step 4: Use a combination of MsgBox along with Round function to round this number up-to one decimal point.

Code:

Sub

Round_Ex2()Dim

roundNumberAs Double

roundNumber = 23.98 MsgBox "The number rounded is: " & Round(roundNumber, 1)End Sub

Step 5: Let’s hit F5 or the Run button to run this code and see the output.

You can see an output as shown in the screenshot above. Please note that with the logic of “round to even”, the last decimal is rounded to 10 and the next decimal becomes 10 itself, due to which the number is rounded to the closest even part of the integer (i.e. 24).

Example #3 – Round Cell Value Using VBA RoundSuppose the value you wanted to round is stored in one cell of your excel worksheet.

All you want is to round this value up-to two decimal places.

Step 1: Define a new sub-procedure in a Module to store the macro.

Sub

Round_Ex3()End Sub

Step 2: Write command as “Range (“A2”).Value =”. This command works as a location where the output will be stored.

Code:

Sub

Round_Ex3() Range("A2").Value =End Sub

Step 3: Now, use a round function to round the value present in cell A1 and store the result in cell A2. Write the following piece of code: Round (Range (“A1”).Value, 2).

Code:

Sub

Round_Ex3() Range("A2").Value = Round(Range("A1").Value, 2)End Sub

Step 4: Hit F5 or Run button to run this code and see the output in cell A2 of your worksheet.

Example #4 – Round a Number Using VBA RoundUp FunctionSuppose, you want to round a number up using VBA. You can do that by using WorksheetFunction.RoundUp function.

Step 1: Define a new sub-procedure in Visual Basic Editor that can store your macro.

Code:

Sub

Round_Ex4()End Sub

Step 2: Define two variables, one to hold the number you wanted to round up. And the other to store the roundup result.

Code:

Sub

Round_Ex4()Dim

numToRoundAs Double

Dim

numRoundUpAs Double

End Sub

Step 3: Store a value into variable numToRound which you wanted to round up.

Code:

Sub

Round_Ex4()Dim

numToRoundAs Double

Dim

numRoundUpAs Double

numToRound = 12.7543712End Sub

Step 4: Now, use RoundUp to roundup this number and store the result in a numRoundUp variable.

Code:

Sub

Round_Ex4()Dim

numToRoundAs Double

Dim

numRoundUpAs Double

numToRound = 12.7543712 numRoundUp = Application.WorksheetFunction.RoundUp(numToRound, 4)End Sub

Step 5: Use MsgBox to show the output under the message box.

Code:

Sub

Round_Ex4()Dim

numToRoundAs Double

Dim

numRoundUpAs Double

numToRound = 12.7543712 numRoundUp = Application.WorksheetFunction.RoundUp(numToRound, 4) MsgBox "The number rounded up is: " & numRoundUpEnd Sub

Step 6: Hit F5 or Run button to run this code and see the output.

Example #5 – Round down a Number Using VBA RoundDown FunctionStep 1: In a new sub-procedure, define two new variables with the name numToRoundDown and roundDownNum. One to hold the value of the number to be rounded down and others to store the output after the number is rounded down.

Code:

Sub

Round_Ex5()Dim

numToRoundDownAs Double

Dim

roundDownNumAs Double

End Sub

Step 2: Assign value you want to be rounded down to the variable named “numToRoundDown”.

Code:

Sub

Round_Ex5()Dim

numToRoundDownAs Double

Dim

roundDownNumAs Double

numToRoundDown = 7.075711End Sub

Step 3: Now, use RoundDown to roundup this number and store the result in a roundDownNum variable.

Code:

Sub

Round_Ex5()Dim

numToRoundDownAs Double

Dim

roundDownNumAs Double

numToRoundDown = 7.075711 roundDownNum = Application.WorksheetFunction.RoundDown(numToRoundDown, 4)End Sub

Step 4: Use MsgBox function to show up the value of a number rounded down.

Code:

Sub

Round_Ex5()Dim

numToRoundDownAs Double

Dim

roundDownNumAs Double

numToRoundDown = 7.075711 roundDownNum = Application.WorksheetFunction.RoundDown(numToRoundDown, 4) MsgBox "The number rounded down is: " & roundDownNumEnd Sub

Step 5: Hit F5 or Run button to run this code and see the output as a message box.

This is it in the article. We have captured the concepts of VBA Round, Round Up and Round Down with a handful of examples.

Things to Remember

This function uses a Banker’s rounding method to round the numbers which are somewhat different than the actual rounding method.

This function is used to round a number with a floating point or a number with fixed-decimals up-to specified number of places.

It means the function will round up or down the number depending upon the number after decimal points.

Argument decimal_places must be greater than or equal to zero.

If decimal_places is left blank, it will be considered as zero and the number will then be rounded to the nearest integer.

If decimal_places is set less than zero, then run time error 5 occurs. “Run-time error ‘5’: Invalid procedure call or argument”.

It is not really predictable to what this function will round the value when the digit after the decimal is 5.

If one or both the argument of Round function is non-numeric, then the function will return run time 13 error. “Run-time error ’13’: Type mismatch”.

Recommended ArticlesThis has been a guide to VBA Round Function. Here we have discussed how to use Excel VBA Round Function along with practical examples and downloadable excel template. You can also go through our other suggested articles –

## How Python Eval Function Work With Examples

Introduction to Python eval()

Web development, programming languages, Software testing & others

Syntax:

eval(expression, globals=None, locals=None)Explanation:

Eval() function usually needs 3 parameters, but the 2nd and 3rd parameter terms are optional/not much important than the 1st parameter. The 3 parameters are expression, globals, and locals.

Expression parameter: This is the string that is as parsed and also evaluated as the Python expression.

Globals parameter ( dictionary parameter ): This parameter is a dictionary, and this parameter is also optional. Nothing happens even if we don’t specify this parameter in the eval() function.

Locals parameter ( Mapping Object ): This locals parameter is an object which is mapping… The dict or dictionary of the globals parameter is the best and standard mapping type in the Python Programming Language commonly.

How Python Eval Function Work with ExamplesEval() function/method will returns the value/result after evaluating the expression. eval function works by parsing the string value, and that string value also be evaluated as the python expression.

Example #1At each and every IF statements, if the IF condition is False, then the interpreter of python goes to the ELSE condition’s statements, and the programming inside of it will be printed/interpreted etc.. all at a time, but the program inside of the ELSE condition is also be interpreted every line one by one.

Code:

x = 10 print(eval('x')) print(eval('x+10')) print(eval('x*x')) print(eval('x*x*x')) if(x%2==0): print('X is even number') if(x%2!=0): if(x%3!=0): if(x%5!=0): if(x%7!=0): print(eval('x')) print('is a prime number') else: print ('x is not prime number') else: print('x is not prime number') else: print('x is not prime number') else: print('x is not prime number')Output:

Example #2Now we enter the try, except concept. These are just like the IF and ELSE condition. If the “try” has correct parameters, then try to run properly and exits from the program, or else the except concept comes into the picture. Try, except concept will be very helpful to handle errors and usage of the eval() function/functions. Statements that are in the try will print the eval() function, which has math functions “square root” and the power of x and y values which are about to declare manually by the user. If the input doesn’t contain any input as needed with the mentioned math functions, the result will be printed, and the loop once again runs and asks again for the input, or else you can just enter and go the except concept. There you will print the ext1 value, and the interpreter breaks out and comes out from the except concept. Then the print statement will print “Now it is Done” like that.

Code:

from math import * for lm in range(1, 3): func1 = input("Enter the Math Function which are mentioned below to Evaluate.nFunctions Allowed are: 1. square_root(x) and 2. power(x,y):n") try: print(eval(func1, {'square_root': sqrt, 'power': pow})) except Exception as ex1: print(ex1) break print('Now it is Done')Output:

Recommended ArticlesThis is a guide to Python eval(). Here we discuss the introduction and working of the python eval() function along with different examples and its code implementation. You may also look at the following articles to learn more –

## Divide In Excel (Formula, Examples)

Introduction to Divide in Excel

In Excel, division is an arithmetic operation commonly used to divide numbers or values of the cell. It is one of the basic mathematical functions essential for solving complex numeric problems.

Unlike addition, which has built-in functions such as the SUM function, no such function is available for division in Excel. To divide numbers or values of a cell in Excel, you need to start with an equal sign (=), followed by the numbers you want to divide, and put a forward slash (/) between the numbers. Businesses often use the divide formula in Excel to calculate and perform various financial and work management tasks. For instance, they might calculate profit margins, monthly budgets, employee wages, expenditure reports, and other important metrics.

Let’s start by understanding how you can perform division in Excel.

The arithmetic operation or formula for division in Excel starts with an equal sign (=) followed by entering the values or cell references you want to divide and a forward slash (/) between them.

How to Divide Numbers in a Cell in Excel?To divide numbers in a cell, directly type the numbers within the cell and apply the divide formula. For example, if you want to divide 10 by 5, enter “=10/5″ in a cell and press “Enter“. The division formula “=10/5” will give a result of 2.

Note: Please start the formula with an equal sign (=) and use the (/) operator between two values in each cell to get the output. For instance, If you only type 10/5 in a cell, Excel will display 05-Oct. Or else Excel will consider the equation as a date.

Example #1

You can download this Divide Formula Excel Template here – Divide Formula Excel Template

How to Divide Numbers Using Cell References?

For example, we want to divide the Cell A1 value by the Cell B1 value and display the result in Cell C1.

Enter the formula “=A1/B1” in Cell C1 and press “Enter“, where the Cell A1 value is the dividend and Cell B2 value is the divisor. The result will be displayed in Cell C1.

Example #2Suppose you want to divide the value of each cell of a column by a certain number obtained in another cell. You can easily do this task. In the below example, you will learn how to divide the values of column A by the value of Cell B1.

Step 2: Enter the formula =” A1/$B$1” and press “Enter“.

Note: The symbol $ in Excel is used for absolute cell references. In the formula =” A1/$B$1″, the value of the divisor is constant as the value of Cell B1. If you place a dollar sign ($) in front of a row, that row is fixed, and if you place a dollar sign ($) in front of a column, that column is fixed.

Result 2 is displayed in cell C1.

Step 3: Drag the cell with the formula to get the desired output.

Congratulations, you have successfully done this task.

Example #3You can divide column 1 with column 2 by using the division formula. Consider the below table with numbers in columns A and B. Follow the below steps to learn how to divide two columns in Excel.

Step 2: Enter the formula “=B3/C3” in Cell D3, as shown below.

Result 5 is displayed in Cell D3.

Step 3: Drag the formula on the corresponding cell to get the following output.

Example #4Under this method, you will learn to use division operators with other arithmetic operators like subtraction to solve complex division problems.

For example, you have the below data of salespersons and their actual sales in 2023 and 2023. You must calculate the sales growth percentage for the respective salesperson in 2023. Here, you must use the division formula, subtraction, and percentage operator.

Step 2: Enter the formula “=(C3-B3)/B3” in Cell D3

Note: Using this formula, “=(C3-B3)/B3″, you can calculate the sales growth percentage for the respective salesperson.

The output is 9%.

Step 3: Drag the cell with the formula downwards to get the desired output

The above result shows the sales growth percentage for the individual salesperson.

Example # 5We have the sales data for five famous companies (Apple, Tesla, Netflix, Starbucks, and McDonald’s) for 2023 and 2023 and the estimated figures for 2023. We need to calculate the percentage growth rate for each company for 2023 using basic mathematical operators such as division, subtraction, and the percentage operator.

Step 1: Add the title “% Growth in 2023” to column E, as shown below.

According to this formula, we will subtract the sales value of 2023 from 2023 and then divide the result by the sales value 2023. The output is the percentage increase in sales from 2023 to 2023.

Note: In this example, we used the formula’s opening and closing parenthesis, “( )”.

The output is 8%, as shown below.

Note: The formula “=(B2+C2)/D2″ will give a decimal value. Thus, convert this decimal value into %.

Step 4: Drag the cell with the formula to get the result, as shown below.

The future sales growth in percentage for all five companies in 2023 is now ready.

How to Use the Division Operator (/) with Addition (+)?Under this method, you will learn to use the division operator with the addition operator (+) with the help of the following examples.

Example #6In this example, we will calculate the average of the student’s marks in maths and science by using the division and addition operator.

Step 1: Add a new column, “Average“, as shown below.

The formula states to add the marks of Maths and Science subjects and then divide by the total subject, i.e., 2.

Result 84 is displayed, as shown in the below image.

Step 3: Now, drag the cell with the formula to the rest of the cells.

The average score of the students in Maths and Science subjects is displayed.

How to Handle #DIV/0! Error Using IF Function?While executing the division operation on a data set, Excel will display the error of #DIV/0! When the formula tries to divide a number by an empty cell or 0. In the following example, you will learn how to use the IF function, such as the “IFERROR” condition, to prevent and resolve the #DIV/0! Error.

Suppose you have the below table of dividends and divisors. You have applied the division formula to this data, and Excel has shown error #DIV/0! in Cell C3 and Cell C5 because Cell B3 and Cell B5 have no value. Now, you want to overcome this problem.

Step 2: Enter the IFERROR formula “=IFERROR(E2/F2,”)” as shown below and press “Enter“.

Note: The Formula “=IFERROR(E2/F2,”)” indicates that divide the value of Cell E2 by Cell F2, and if there is an empty cell or 0 value, then leave the cell blank in the result column to avoid displaying of the #DIV/0! Error.

Output 4 is displayed.

Step 3: Drag the cell with the formula as shown below.

The result is displayed above, and Cell G3 and Cell G5 are blank instead of #DIV/0! Error.

Things to Remember while Using the Divide Function in Excel

Put an equal sign (=) in the cell before using the divide formula.

While selecting the data for calculation, do not select the row or column headers.

If there is an empty cell or 0 value in the Cell, then Excel will throw an #DIV/0!

You should properly use the opening and closing parenthesis in the division formula. For example, formulas like “=10/4-2” will give 0.5 output, and “=10/(4-2)” will give 5 output. Always remember, the “PEDMAS” is the order of calculations in Excel.

If you want to display only the integer value of a division operation, use the QUOTIENT function of Excel.

Frequently Asked Questions (FAQS)Answer: The symbol or arithmetic operator used to represent divide or division in Microsoft Excel is “/“, a forward slash. The Excel division formula is “=x/y,” where x is the dividend and y is the divisor.

Answer: There are various methods to divide in Excel. You can directly type the numbers in a cell or divide two (or more) numbers by referring to a cell or constant number. As seen in the image below, you must use an equal sign (=) before the division formula and a forward slash (/) between the numbers or cells you want to divide.

Answer: The alternate method for dividing numbers is using the “QUOTIENT” formula. When you want to display only the integer part of a division, use the formula “QUOTIENT(numerator, denominator)”. If a division equation has a remainder value, the QUOTIENT function will only return the integer value as an output. For example,” =3/2” returns 1.5 whereas “=QUOTIENT(3,2)” returns 1, where 1.5 is the remainder, and 1 is the integer/quotient.

Recommended ArticlesThis article has been a guide to Dividing in Excel. Here we discuss the Divide Formula in Excel and How to use Divide Formula in various scenarios using practical examples. Furthermore, you can read our other suggested articles. You also get a downloadable Excel template for your reference.

## How To Use Java Serversocket With Examples

Introduction to Java ServerSocket

The following article provides an outline on Java ServerSocket. In web technology, we have used front end and backend codes separately for creating web applications for the secure chúng tôi web application contains servers for receiving the client request and sent to the response for the clients’ particular request. In java technology, with the help of socket programs, we can achieve these tasks when we will send multiple requests with the help of multiple pcs, which has to be connected with the protocols like tcp and udp. We can write the server codes like ServerSocket class, connect with the specified ports, and send them to the data.

Start Your Free Software Development Course

Syntax:

The serversocket class is used for the client and server transfer process.

Server Class:

java packages import(import java.io.*,import java.net.*) class serverclassname { public static void main(String[] args) { try { --some logic— } catch() { } } }Client class:

Java packages import(import java.io.*,import java.net.*) class clientclassname { public static void main(String[] args) { try { --some logic— } catch() { } } } How to use Java ServerSocket?

Java server socket connections will use the two types of protocols for sent and receive the data.

TCP(transfer control protocol) and udp(user datagram protocol) will use the sockets class to transfer the data.

We also see some difference between these two protocols while we use in the socket class when we use udp, it means is a connection less, and there are no sessions for storing the log data regarding client and server transmissions, but in tcp, it is a connection-oriented, so the client and server have the session storages in the log folders.

The socket programs will be used for communications between the web applications running with the different jre.

The serversocket class are mainly with the connection-oriented socket programs.

When we connect the applications with the help of socket, we need to get the information’s like IP Address of the servers and port numbers which has to be connected with the applications for a specified way so that the data transmission will not be interpreted.

Basically, the socket class between client and server is one-way data transmission. The client will send the request messages to the server, servers read the client messages, and send the response to the client, or else it will display the data on the client screen like browsers.

So that we will use two types of java net classes are used a socket and serversocket classes; the socket class is responsible for client-server communications, serversocket class is used for server-side applications it will authenticate the request from the client-side until the client machine is connected with the socket class after the successful connections it will return the socket class instance in the server-side applications.

Examples of Java ServerSocketGiven below are the examples:

Example #1Code: Client Example

import java.io.IOException; import java.io.PrintStream; import java.net.Socket; import java.net.UnknownHostException; import java.util.Scanner; public class clientSample { public static void main(String arg[]) throws UnknownHostException,IOException { int n,n1; String s; Scanner sc=new Scanner(System.in); Socket s1=new Socket("127.0.0.1",1408); Scanner sc1=new Scanner(s1.getInputStream()); System.out.println("Enter any port numbers"); n=sc.nextInt(); PrintStream p=new PrintStream(s1.getOutputStream()); p.println(n); n1=sc1.nextInt(); System.out.println("Square of the given port number is: "+n1); } }Output:

import java.io.IOException; import java.io.PrintStream; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; import java.util.Scanner; public class ServerSample { public static void main(String[] args)throws IOException { int n,n1; String s; ServerSocket s1=new ServerSocket(1408); Socket s2=s1.accept(); Scanner sc=new Scanner(s2.getInputStream()); s=s2.toString(); n =sc.nextInt(); n1=n*n; PrintStream p=new PrintStream(s2.getOutputStream()); p.println(n1); System.out.println("Server started and working.. "); } }Output:

Example #2Code: Client Example

import java.net.*; import java.io.*; public class clientSample { public static void main(String[] args) throws Exception { try{ Socket s=new Socket("127.0.0.1",8888); DataInputStream d=new DataInputStream(s.getInputStream()); DataOutputStream out=new DataOutputStream(s.getOutputStream()); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String client="",server=""; while(!client.equals("")){ System.out.println("Enter the number :"); client=br.readLine(); out.writeUTF(client); out.flush(); server=d.readUTF(); System.out.println(server); } out.close(); out.close(); s.close(); }catch(Exception e){ System.out.println(e); } } }Code: Server Client

import java.io.DataInputStream; import java.io.DataOutputStream; import java.net.Socket; class ServerClients extends Thread { Socket sockets; int clients; int squre; ServerClients(Socket s,int count){ sockets = s; clients=count; } public void run(){ try{ DataInputStream inStream = new DataInputStream(sockets.getInputStream()); DataOutputStream outStream = new DataOutputStream(sockets.getOutputStream()); String client="", server=""; while(!client.equals("")){ client=inStream.readUTF(); System.out.println("From Client side-" +clients+ ": Number of client is :"+client); squre = Integer.parseInt(client) * Integer.parseInt(client); server="From Server to Client request-" + clients + " Square of the client " + client + " is " +squre; outStream.writeUTF(server); outStream.flush(); } inStream.close(); outStream.close(); sockets.close(); }catch(Exception ex){ System.out.println(ex); }finally{ System.out.println("Client -" + clients + " exit!! "); } } }Code: Server Example

import java.net.*; import java.io.*; public class ServerSample { public static void main(String[] args) throws Exception { try{ ServerSocket s=new ServerSocket(8888); int count=0; System.out.println("Server is Started ...."); while(true){ count++; Socket socket=s.accept(); ServerClients sc = new ServerClients(socket,count); sc.start(); } }catch(Exception e){ System.out.println(e); } } }Output:

Example #3Code: Client Program

import java.net.*; import java.io.*; public class ClientMain { public static void main (String[] args ) throws IOException { int size=1022388; int bytess; int c = 0; Socket sockets = new Socket("localhost",12345); byte [] bytes = new byte [size]; InputStream in = sockets.getInputStream(); FileOutputStream out = new FileOutputStream("F:\copy.doc"); BufferedOutputStream b = new BufferedOutputStream(out); bytess= in.read(bytes,0,bytes.length); c = bytess; do { bytess = in.read(bytes, c, (bytes.length-c)); } b.write(bytes, 0 , c); b.flush(); b.close(); sockets.close(); } }Code: Server Program

import java.net.*; import java.io.*; public class Main { public static void main (String [] args ) throws IOException { ServerSocket serverSockets = new ServerSocket(12345); Socket sockets = serverSockets.accept(); System.out.println("Server connection Accepted : " + sockets); File f = new File ("F:\Sample.docx"); byte [] bytes = new byte [(int)f.length()]; FileInputStream input = new FileInputStream(f); BufferedInputStream b = new BufferedInputStream(input); b.read(bytes,0,bytes.length); OutputStream output = sockets.getOutputStream(); System.out.println("Sending Files..."); output.write(bytes,0,bytes.length); output.flush(); sockets.close(); System.out.println("File transfer complete"); } }Output:

ConclusionIn java programming technology, the package is called java.net.* In that each version of java it may vary the classes in the package the server socket connection is a basic networking feature for file transmission, upload and even though we have sent an email from one client to another client with the help of socket connections

Recommended Articles

This is a guide to Java ServerSocket. Here we discuss the introduction, how to use Java ServerSocket, along with respective examples. You may also have a look at the following articles to learn more –

## How To Use Html Schriftart With Examples

Introduction to HTML Schriftart

Web development, programming languages, Software testing & others

Syntax:

Htmlfonts(Schriftart) is using some style attributes in CSS styles, and also using font tag we declared the font face, size, and colors.

The above code is one of the basic syntaxes for the html fonts declared and used in the web pages. We also displayed the fonts in different style attributes like bold, italic and underlined views.

How to Use Html Schriftart?

The annotation-based html tag is used in the CSS styles on the side of the browser; it will load the default one in the HTML web page it may be created an issue. If we call the external fonts in the web browsers using the style like @font-face, whenever the user use the text, it will convert automatically to the given font styles whichever we assign the fonts in the css it will be used for the completely invisible side in the front end. In some type of browsers will be waiting for loading the custom fonts in the web pages; it may take some time to load the web page; normally, it will take 3 seconds to display the web pages.

In Webkit type of browsers like safari, android browsers, and blackberry mobile browsers, it may take upto 30 seconds over time to load the web pages. Some times custom fonts will represent in potentially some failure in the usable sites. If we use css styles, it will look appearance more flexible, user-friendly even we download any other files it also looks pretty and very simple to use on the web pages.

In most browsers, the default font size is 3, and in the majority of the web sites, the text values will be the range from 2 to 3; it may vary when compared to each browser and web sites. The font size will be declared into two different categories 1. Absolutely and chúng tôi Absolute sizes range between 1 and 7; the values will have differed when the user browsers compatibility. We can also resize the fonts after the declaration of the font sizes it will affect the user texts in the web pages also differ it will adapt the user preferences that is the text size will be displayed somewhat different from user expectation it will show like high, very high or low text will be shown as the above types. If we set the font size will be very less length it’s difficult to read the web pages on the user end.

If we use high font length, then the web page will be a continuation from another page; the user will also scroll the web pages the navigation it’s needed for the front end. The text font size will be user end, so it will choose the user point of view it will show the normal and the appearance will be more sophisticated in the front end. Whenever we create a web page, it will intend to make them accessible in the www consortium; then, it will permit us to display the web page in globally.

Generally, font face values will be some fixed one like “Times New Roman, Comic sans MS, Arial, Calibri”, etc. the above 3 to 4 font faces will be used for most of the web sites even though the “Schriftart” this font will be used in the web page documents. We can set the font face with the help of face attributes, but we should also be aware that if the user does not log in and view the pages in the browsers because the font styles should be installed in the user pcs then only it will be displayed in the browser screen. If the font is not installed, the user will see the screen using the default font, which already installed on the pc.

Examples to Implement HTML SchriftartBelow are the examples mentioned:

Example #1Code:

Example #2Code:

Output:

Example #3Welcome User Welcome To My Domain

Output:

Explanation to the above examples: In the above three examples, we discussed the font sizes with different ranges; the above three outputs are executed in the chrome browsers the font size whatever we mention in the code it will be displayed in the browser the final example we have seen the font size, styles, and colors.

ConclusionWe have seen the html schriftart(font) is angerman language fonts; we will use the fonts to translate the html predefined tags to convert the german language, but the functionalities of the fonts are to be the same as we discussed in the font features, colors, and sizes. In CSS, it will declare in the font style attributes it will mention all the font behaviors.

Recommended ArticlesThis is a guide to HTML Schriftart. Here we discuss the introduction to Html Schriftart with examples for better understanding. You can also go through our other related articles to learn more –

Update the detailed information about **How To Use Excel Countif Function (Examples + Video)** on the Moimoishop.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!